public static int addZeros(int valueToAddZeros, int valueToCompare){
while(String.valueOf(valueToCompare).length() > String.valueOf(valueToAddZeros).length()){
valueToAddZeros = valueToAddZeros * 10;
}
return valueToAddZeros;
}
1
solved java – How to add zeros to an int until this int lenght equals the int2 lenght? [duplicate]