i wrote a code to encrypt the 4 digit number.
i broke the number in digits and encrypted it.
It works fine. But the problem comes when first digit in output comes 0.
that time i get 3 digit number instead of 4 digit number. i want it to show 0(3 digit answer).
how can i fix the length of the output number to 4 ?

Use DecimalFormat

DecimalFormat df = new DecimalFormat("0000");
      int a=23;

i found it out as
%04d\n in printf statement.