Java Printf Leading Zeros

[Solved] Java Printf Leading Zeros | Perl - Code Explorer | yomemimo.com
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

Answers related to java printf leading zeros

Code Explorer Popular Question For Perl