Well it wouldn't be possible to have integer with 00 in the beginning of that literal. As,its not code as such for literals like integer under JVM specifications.
Possible solutions..
1)If you are particular about number of digits in that int
You might use padding technique over that integer which will
resolve your problem of appending zero's on left at any cost.
/**
* Pads a String
s
to take up
n
* characters, padding with char
c
on the
* left (
true
) or on the right (
false
).
* Returns
null
if passed a
null
* String.
**/
public static String paddingString(String s, int n, char c,
boolean paddingLeft) {
if (s == null) {
return s;
}
int add = n - s.length(); // may overflow int size... should not be a problem in real life
if(add <= 0){
return s;
}
StringBuffer str = new StringBuffer(s);
char[] ch = new char[add];
Arrays.fill(ch, c);
if(paddingLeft){
str.insert(0, ch);
} else {
str.append(ch);
}
return str.toString();
}
so you can apply technique on every integer once you are done with
int related operation over it.
2)Decimalformatter
You need to first divide the number by considered number of digits with that number of zeros
1234 will be ..1234 ie. 1234/10000
later use something like
String frmt="#0.000";
NumberFormat formatter = new DecimalFormat(frmt);
formatter.format(number)
get some more formats at
http://java.sun.com/j2se/1.4.2/docs/api/java/text/DecimalFormat.html
Hope this does resolves your issues
Cheers:)