public class Formatters
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
formatDouble(double x,
int d)
Formats a double.
|
static java.lang.String |
formatFloat(float x,
int d)
Formats a float.
|
static java.lang.String |
formatIntegerWithCommas(int n)
Formats an integer with commas.
|
static java.lang.String |
formatLongWithCommas(long n)
Formats a long with commas.
|
public static java.lang.String formatIntegerWithCommas(int n)
n
- The number.public static java.lang.String formatLongWithCommas(long n)
n
- The number.public static java.lang.String formatFloat(float x, int d)
The formatted number always has a minimum of one digit before the decimal point, and a fixed specified number of digits after the decimal point.
x
- The number.d
- Number of digits after the decimal point.public static java.lang.String formatDouble(double x, int d)
The formatted number always has a minimum of one digit before the decimal point, and a fixed specified number of digits after the decimal point.
x
- The number.d
- Number of digits after the decimal point.