org.jscience.computing.ai.util
Class Converter

java.lang.Object
  extended by org.jscience.computing.ai.util.Converter

public class Converter
extends java.lang.Object

Utility class for conversions


Constructor Summary
Converter()
           
 
Method Summary
static int binaryString2Int(java.lang.String binary)
          Returns integer value of given bits
static int booleanArrayToInt(boolean[] booleanArray)
          Returns int value of the given array of bits.
static java.lang.String booleanArrayToString(boolean[] booleanArray)
          Returns string representation of the given array of bits.
static java.lang.String booleanToString(boolean bit)
          Returns string representation of the given bit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Converter

public Converter()
Method Detail

booleanToString

public static java.lang.String booleanToString(boolean bit)
Returns string representation of the given bit.

Parameters:
bit - boolean value of the given bit
Returns:
if bit is true then 1 is returned, else 0 is returned

booleanArrayToString

public static java.lang.String booleanArrayToString(boolean[] booleanArray)
Returns string representation of the given array of bits. Each bit is converted using booleanToString(...) method and concatenated.

Parameters:
booleanArray - boolean array of the given bits
Returns:
string representation of given array of bits

booleanArrayToInt

public static int booleanArrayToInt(boolean[] booleanArray)
Returns int value of the given array of bits. booleanArrayToString(...) method is called for the given array of bits, then the returned value is converted to int value

Parameters:
booleanArray - boolean array of the given bits
Returns:
int value of the given array of bits

binaryString2Int

public static int binaryString2Int(java.lang.String binary)
Returns integer value of given bits

Parameters:
binary - string representation of given bits
Returns:
integer value of given string