edu.northwestern.at.utils
Class Formatters

java.lang.Object
  extended by edu.northwestern.at.utils.Formatters

public class Formatters
extends java.lang.Object

Formatting utilties.


Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

formatIntegerWithCommas

public static java.lang.String formatIntegerWithCommas(int n)
Formats an integer with commas.

Parameters:
n - The number.
Returns:
The formatted number with commas.

formatLongWithCommas

public static java.lang.String formatLongWithCommas(long n)
Formats a long with commas.

Parameters:
n - The number.
Returns:
The formatted number with commas.

formatFloat

public static java.lang.String formatFloat(float x,
                                           int d)
Formats a float.

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.

Parameters:
x - The number.
d - Number of digits after the decimal point.
Returns:
The formatted number.

formatDouble

public static java.lang.String formatDouble(double x,
                                            int d)
Formats a double.

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.

Parameters:
x - The number.
d - Number of digits after the decimal point.
Returns:
The formatted number.