You are viewing a single comment's thread. Return to all comments →
if our first input integer is 2384754 or second 5 so how we add 000000 to make this like 0000005.
%07d will add 000000 followed by 5
common sense. Haha
thank you soooooo much:)
They have asked for only numbers between 0 and 999 here so the %03d padding is enough here.
If you need more digits in your number, then you give padding as necessary; in your case, %07d.
if i want to add 1 in place of zero ,to make three digit number then what will be solution
is there no solution for this quesion
you can calculate the length of integer and then add 100 for two digit integer of add 110 to a single digit integer
can we use %03d in other languages .if yes then please can you name them?
Check out C - it also has printf
hey I'm actually unaware of this statement "%-15s%03d%n"
and can anyone help me? like explain this or send a website where it's explained. i read the comments but that's not enough for me i need to know the basics.
Thank you for sharing this great resource!
System.out.println( StringUtils.leftPad("5", 7, "0") );