It looks like you want the left panel with spaces, so maybe you want:
String.format("%3d", yourInteger);
For instance:
int[] values = { 500, 4, 11, 234 }; for (int v : values) { System.out.println(String.format("%3d", v)); }
Conclusion:
500
4
eleven
234
source share