org.jcoderz.commons.util
Class NumberUtil

java.lang.Object
  extended by org.jcoderz.commons.util.NumberUtil

public final class NumberUtil
extends Object

Utility methods around Numbers. Mainly for BigDecimals, used by the restricted number strong types.

Author:
Andreas Mandel

Method Summary
static int countDigits(long value)
          Counts the number of decimal digits needed to represent the given value.
static String toString(long unscaledValue, int scale)
          Convert the given unscaled long with the given scale to it's string representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

countDigits

public static int countDigits(long value)
Counts the number of decimal digits needed to represent the given value.

Parameters:
value - the value to count for.
Returns:
the number of decimal digits needed to represent the given value.

toString

public static String toString(long unscaledValue,
                              int scale)
Convert the given unscaled long with the given scale to it's string representation.

Parameters:
unscaledValue - the scaled long.
scale - the scale to be applied.
Returns:
string representation of the scaled value using a dot '.' as decimal separator.


Copyright 2007 The jCoderZ Project.