Class Utils

java.lang.Object
  |
  +--Utils

public abstract class Utils
extends java.lang.Object

This class offers several base manipulation services (hexadecimal, binary, 2^n).
You can read the source of this class here.


Constructor Summary
Utils()
           
 
Method Summary
static java.lang.String bin(int num, int nbits, int sep)
          Computes a String that represents num in binary format.
static java.lang.String hex(int num, int ndigits, int sep)
          Computes a String that represents num in hexadecimal format.
static int hex2num(java.lang.String s)
          Computes the int value of the hexadecimal number represented by s.
static int Puiss2(int n)
          Returns 2^n, with n between 0 and 16.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utils

public Utils()
Method Detail

Puiss2

public static int Puiss2(int n)
Returns 2^n, with n between 0 and 16.

bin

public static java.lang.String bin(int num,
                                   int nbits,
                                   int sep)
Computes a String that represents num in binary format.
Parameters:
num - Number to convert.
nbits - Number of bits to output.
sep - Number of bits of each group separated by a space.
Returns:
A String made of nbits of num in binary format in groups of sep bits.

hex

public static java.lang.String hex(int num,
                                   int ndigits,
                                   int sep)
Computes a String that represents num in hexadecimal format.
Parameters:
num - Number to convert.
ndigits - Number of digits to output.
sep - Number of digits of each group separated by a space.
Returns:
A String made of ndigits of num in hexadecimal format in groups of sep digits.

hex2num

public static int hex2num(java.lang.String s)
Computes the int value of the hexadecimal number represented by s.
Parameters:
s - An hexadecimal number only made of hexadecimal digits ; the conversion stops when an illagal character is encountered.
Returns:
The int value of the hexadecimal number represented by s.