formatting an integer in java
Default formatting:
String.format("%d", 93); // prints 93
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|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|
Also in Java:
- array null pointer java
- java unit test an api
- how to get witdth of window android
- java initialize string array
- how to break two loop in java
- how to print in java
- write file from a specific location in java
- java uuid
- java final meaning
- how to create a thread local variable in java
- how to exit a for loop in java
- java timestamp
- java prev permutation
- spring iterate
- android get distance between two locations kotlin
- java observable to observer stack overflow
- list java oracle
- jsonobject to java object
- java for
- how to use for loop for array in java
- java jaxb unmarshall xml to map
- change java version command line debian
- eliminar el primer caracter de un string java
- java previous permutation