Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

formatting an integer in java

Specifying a width:

String.format("|%20d|", 93); // prints: |                  93|


Left-justifying within the specified width:

String.format("|%-20d|", 93); // prints: |93                  |


Pad with zeros:

String.format("|%020d|", 93); // prints: |00000000000000000093|
Comment

PREVIOUS NEXT
Code Example
Java :: native insert query in jpa repository 
Java :: change string to char array 
Java :: how to find the size of a queue in java 
Java :: how to create an array list in java 
Java :: icon label java 
Java :: how to update java on windows 10 
Java :: initialize applet in java 
Java :: java currency format 
Java :: java run code at interval 
Java :: send action bar message bukkit 
Java :: difference between object and class 
Java :: java  
Java :: java swing set icon to JFrame 
Java :: which api is android 12 
Java :: hello world program in java 
Java :: java wait for user input 
Java :: set look and feel system default java 
Java :: arraylist add new element to end 
Java :: java exception list 
Java :: java collection interface 
Java :: how to substring in java 
Java :: java datatypes 
Java :: while loop in java 
Java :: java swing windows 10 look and feel 
Java :: declaration and definition of array in java 
Java :: how to convert kilometers to miles in java 
Java :: fixed length array powershell PSv5+ 
Java :: change status bar text color android programmatically 
Java :: System.out.printf("%"+(n)+"s ") 
Java :: java map create with values 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =