game.libraries.general
Class Conversion

java.lang.Object
  |
  +--game.libraries.general.Conversion

public class Conversion
extends java.lang.Object

Static class to provide conversion routines.


Method Summary
static float fromPercent(java.lang.String percent)
          Convert a percentage to a float, rounded to the nearest whole number percent (that is, to the nearest 0.01).
static java.lang.String toPercent(float value)
          Convert the data to a printable percentage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toPercent

public static java.lang.String toPercent(float value)
Convert the data to a printable percentage.

Returns:
the data as a string with a % sign.

fromPercent

public static float fromPercent(java.lang.String percent)
                         throws java.lang.NumberFormatException
Convert a percentage to a float, rounded to the nearest whole number percent (that is, to the nearest 0.01).

Returns:
the data as a float.
java.lang.NumberFormatException