Package mathvoyage
Class vmath.baseConverter
java.lang.Object
mathvoyage.vmath.baseConverter
- Enclosing class:
vmath
Contains functions to convert numbers from one base to another.
- Author:
- Adib Sakhawat
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleConverts a binery number (string) to decimal number (double).static StringConverts a binary number (string) to a hexadecimal number (string).static StringConverts a binary number (string) to a number of any base (string).static StringConverts a binary number (string) to an octal number (string).static StringdecToBin(double decimalNumber) Converts a decimal number (double) to binery number (string).static StringdecToHex(double decimalNumber) Converts a decimal number (double) to Hexadecimal number (string).static StringdecToN(double decimalNumber, int base) Converts a decimal number (double) to a number of any base (string).static StringdecToOct(double decimalNumber) Converts a decimal number (double) to Octal number (string).static StringConverts a hexadecimal number (string) to a binary number (string).static doubleConverts a Hexadecimal number (string) to decimal number (double).static StringConverts a number from hexadecimal to any basestatic StringConverts a number from hexadecimal to octalstatic doubleConverts a number of any base (string) to a decimal number (double).static StringConverts a number from any base to any basestatic StringConverts an octal number (string) to a binary number (string).static doubleConverts an Octal number (String) to a Decimal number (double).static StringConverts a number from octal to hexadecimalstatic StringConverts a number from octal to any base
-
Constructor Details
-
baseConverter
public baseConverter()
-
-
Method Details
-
binToDec
Converts a binery number (string) to decimal number (double).- Parameters:
bineryNumber- The binery number in string format- Returns:
- The decimal number
-
decToBin
Converts a decimal number (double) to binery number (string).- Parameters:
decimalNumber- The decimal number- Returns:
- The binery number in string format
-
decToHex
Converts a decimal number (double) to Hexadecimal number (string).- Parameters:
decimalNumber- The decimal number- Returns:
- The Hexadecimal number in string format
-
hexToDec
Converts a Hexadecimal number (string) to decimal number (double).- Parameters:
hexadecimalString- The Hexadecimal number in string format- Returns:
- The decimal number
-
octToDec
Converts an Octal number (String) to a Decimal number (double).- Parameters:
octalString- The decimal number- Returns:
- The Octal number in string format
-
decToOct
Converts a decimal number (double) to Octal number (string).- Parameters:
decimalNumber- The decimal number- Returns:
- The Octal number in string format
-
decToN
Converts a decimal number (double) to a number of any base (string).- Parameters:
decimalNumber- the decimal numberbase- the base- Returns:
- The number in string format
-
nToDec
Converts a number of any base (string) to a decimal number (double).- Parameters:
number- the numberbase- the base- Returns:
- The decimal number
-
binToOct
Converts a binary number (string) to an octal number (string).- Parameters:
binaryString- the binary string- Returns:
- string
-
octToBin
Converts an octal number (string) to a binary number (string).- Parameters:
octalString- the octal string- Returns:
- The binary number in string format
-
binToHex
Converts a binary number (string) to a hexadecimal number (string).- Parameters:
binaryString- the binary string- Returns:
- The hexadecimal number in string format
-
hexToBin
Converts a hexadecimal number (string) to a binary number (string).- Parameters:
hexadecimalString- the hexadecimal string- Returns:
- The binary number in string format
-
binToN
Converts a binary number (string) to a number of any base (string).- Parameters:
binaryString- the binary stringbase- the base- Returns:
- The number in string format
-
octToHex
Converts a number from octal to hexadecimal- Parameters:
octalString- the octal string- Returns:
- The hexadecimal number in string format
-
hexToOct
Converts a number from hexadecimal to octal- Parameters:
hexadecimalString- the hexadecimal string- Returns:
- The octal number in string format
-
octToN
Converts a number from octal to any base- Parameters:
octalString- the octal stringbase- the base- Returns:
- The number in string format
-
hexToN
Converts a number from hexadecimal to any base- Parameters:
hexadecimalString- the hexadecimal stringbase- the base- Returns:
- The number in string format
-
nToK
Converts a number from any base to any base- Parameters:
baseNString- the base n stringbaseN- the base nbaseK- the base k- Returns:
- The binary number in string format
-