Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java printf leading zeros

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
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: java key pressed 
Java :: volley library dependency 
Java :: change color of text in textview android 
Java :: hellow world java code 
Java :: last method in jdbc 
Java :: java swing jtable different color each row 
Java :: set drawableleft programmatically android 
Java :: spring data rest format time 
Java :: programmation android avoir acces à la liste des intents de partage 
Java :: big integer input in java 
Java :: get player by name spigot 
Java :: java swing array of buttons 
Java :: array ausgeben java 
Java :: how to add image in title bar in android 
Java :: java real random 
Java :: ubuntu java development kit 
Java :: add value with n variable with Arraylist in java 
Java :: use view binding in fragment 
Java :: react native android gif 
Java :: how to import jframe in java 
Java :: print a to z in java 
Java :: How to create a union-find data structure, in Java? 
Java :: java list to set 
Java :: round off java 2 decimal places 
Java :: read file in java 
Java :: convert double to in in java 
Java :: write json string to file in java 
Java :: how to destroy activity in android 
Java :: java date with T 
Java :: add seconds to today date and time java 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =