net.ctdp.rfdynhud.util
Class NumberUtil
java.lang.Object
net.ctdp.rfdynhud.util.NumberUtil
public class NumberUtil
- extends java.lang.Object
The NumberUtil
keeps static methods to format numbers.
- Author:
- Marvin Froehlich (CTDP)
Method Summary |
static java.lang.String |
delta(float i)
|
static java.lang.String |
delta(int i)
|
static java.lang.String |
formatFloat(float f,
int numDecPlaces,
boolean forceFractions)
Formats the given float to a String with the specified number of decimal places. |
static java.lang.String |
pad2(int number)
|
static int |
roundUpPower2(int v)
Gets the next greater power-of-two for the given number. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NumberUtil
public NumberUtil()
pad2
public static final java.lang.String pad2(int number)
formatFloat
public static final java.lang.String formatFloat(float f,
int numDecPlaces,
boolean forceFractions)
- Formats the given float to a String with the specified number of decimal places.
- Parameters:
f
- the number to formatnumDecPlaces
- the maximum number of decimal placesforceFractions
- always format with maximum number of fractions?
- Returns:
- the formatted String.
roundUpPower2
public static final int roundUpPower2(int v)
- Gets the next greater power-of-two for the given number.
- Parameters:
v
- the value to round up
- Returns:
- the next greater power-of-two for the given number.
delta
public static final java.lang.String delta(int i)
delta
public static final java.lang.String delta(float i)