Answers for "format a number in java with %"

1

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|
Posted by: Guest on May-02-2020
0

number format java

i will refer this site just read it and you will understand everything
i hope this help:https://zetcode.com/java/numberformat/
Posted by: Guest on June-29-2021
0

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|
Posted by: Guest on May-02-2020

Code answers related to "format a number in java with %"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language