Question : java printf leading zeros
Answered by : jerome-gutierrez
public class Main { public static void main(String[] args) { int number = 2; System.out.println(String.format("%04d", number)); // 0 - declares padding between the zeroes // 4 - declares the width of the string }
}
Source : | Last Update : Mon, 25 Jul 22