Class NumberConverter

java.lang.Object
  |
  +--NumberConverter

public class NumberConverter
extends java.lang.Object

Makes conversions between, decimal, binary, octal and Hex representations.

Version:
(21 March 2002)
Author:
(Antonios Symvonis)

Constructor Summary
NumberConverter()
           
 
Method Summary
static long bin2Dec(java.lang.String binary)
          Binary to decimal conversion
static java.lang.String bin2Hex(java.lang.String binary)
          Binary to hexadecimal conversion
static java.lang.String bin2Oct(java.lang.String binary)
          Binary to octal conversion
static java.lang.String dec2Bin(long decimal)
          Decimal to binary conversion
static java.lang.String dec2Hex(long decimal)
          Decimal to hexadecimal conversion
static java.lang.String dec2Oct(long decimal)
          Decimal to octal conversion
static java.lang.String hex2Bin(java.lang.String hex)
          hexadecimal to binary conversion
static long hex2Dec(java.lang.String hex)
          Hexadecimal to decimal conversion
static java.lang.String oct2Bin(java.lang.String octal)
          Octal to binary conversion
static long oct2Dec(java.lang.String octal)
          Octal to decimal conversion
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumberConverter

public NumberConverter()
Method Detail

bin2Dec

public static long bin2Dec(java.lang.String binary)
Binary to decimal conversion
Parameters:
binary - a binary number of at most 63 bits.
Returns:
The decimal representation of the parameter

bin2Hex

public static java.lang.String bin2Hex(java.lang.String binary)
Binary to hexadecimal conversion
Parameters:
binary - a binary number of arbitrary length.
Returns:
The hexadecimal representation of the parameter

bin2Oct

public static java.lang.String bin2Oct(java.lang.String binary)
Binary to octal conversion
Parameters:
binary - a binary number of arbitrary length.
Returns:
The octal representation of the parameter

dec2Bin

public static java.lang.String dec2Bin(long decimal)
Decimal to binary conversion
Parameters:
decimal - a decimal number.
Returns:
The binary representation of the parameter

dec2Hex

public static java.lang.String dec2Hex(long decimal)
Decimal to hexadecimal conversion
Parameters:
decimal - a decimal number.
Returns:
The hexadecimal representation of the parameter

dec2Oct

public static java.lang.String dec2Oct(long decimal)
Decimal to octal conversion
Parameters:
decimal - a decimal number.
Returns:
The octal representation of the parameter

hex2Bin

public static java.lang.String hex2Bin(java.lang.String hex)
hexadecimal to binary conversion
Parameters:
hex - a hexadecimal number of arbitrary length.
Returns:
The binary representation of the parameter

hex2Dec

public static long hex2Dec(java.lang.String hex)
Hexadecimal to decimal conversion
Parameters:
hex - a hexadecimal number of at most 15 digits.
Returns:
The decimal representation of the parameter

oct2Bin

public static java.lang.String oct2Bin(java.lang.String octal)
Octal to binary conversion
Parameters:
octal - an octal number of arbitrary length.
Returns:
The binary representation of the parameter

oct2Dec

public static long oct2Dec(java.lang.String octal)
Octal to decimal conversion
Parameters:
octal - an octal number of at most 21 digits.
Returns:
The decimal representation of the parameter


Generated by BlueJ