annas.math
Class BaseConverter

java.lang.Object
  extended by annas.math.BaseConverter

public class BaseConverter
extends java.lang.Object


Constructor Summary
BaseConverter()
           
 
Method Summary
static int fromBinaryString(java.lang.String s)
           
static int fromHexString(java.lang.String s)
           
static java.lang.String toBinaryString(int n)
          Converts to Binary
static java.lang.String toHexString(int n)
          Converts to Hex
static java.lang.String toString(int n, int base)
          Converts from Decimal to the base provided
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseConverter

public BaseConverter()
Method Detail

toString

public static java.lang.String toString(int n,
                                        int base)
Converts from Decimal to the base provided

Parameters:
n - Number to convert
base - Base (not to exceed 36, runs out of character)
Returns:
String representation of the number

toBinaryString

public static java.lang.String toBinaryString(int n)
Converts to Binary

Parameters:
n - Number to convert
Returns:
String representation of n presented in binary

toHexString

public static java.lang.String toHexString(int n)
Converts to Hex

Parameters:
n - Number to convert
Returns:
String representation of n presented in Hex

fromBinaryString

public static int fromBinaryString(java.lang.String s)

fromHexString

public static int fromHexString(java.lang.String s)