Package mathvoyage.NumberSystem
Class BaseConverter
java.lang.Object
mathvoyage.NumberSystem.BaseConverter
The type Base converter.
-
Method Summary
Modifier and TypeMethodDescriptionbaseNToBaseK(String baseNString, int baseN, int baseK) Base n to base k string.doublebaseNToDecimal(String baseNString, int base) Converts a base-n string to a decimal numberbinaryToBaseN(String binaryString, int base) Binary to base n string.doublebinaryToDecimal(String binaryString) Converts a binary string to a decimal numberbinaryToHexadecimal(String binaryString) Converts a binary string to a hexadecimal stringbinaryToOctal(String binaryString) Converts a binary string to an octal stringdecimalToBaseN(double decimalNumber, int base) Converts a decimal number to a base-n stringdecimalToBinary(double decimalNumber) Converts a decimal number to a binary stringdecimalToHexadecimal(double decimalNumber) Converts a decimal number to a hexadecimal stringdecimalToOctal(double decimalNumber) Converts a decimal number to an octal stringstatic BaseConverterReturns the singleton instance of this class.hexadecimalToBaseN(String hexadecimalString, int base) Hexadecimal to base n string.hexadecimalToBinary(String hexadecimalString) Converts a hexadecimal string to a binary stringdoublehexadecimalToDecimal(String hexadecimalString) Converts a hexadecimal string to a decimal numberhexadecimalToOctal(String hexadecimalString) Hexadecimal to octal string.octalToBaseN(String octalString, int base) Octal to base n string.octalToBinary(String octalString) Converts an octal string to a binary stringdoubleoctalToDecimal(String octalString) Converts an octal string to a decimal numberoctalToHexadecimal(String octalString) Octal to hexadecimal string.
-
Method Details
-
getInstance
Returns the singleton instance of this class.- Returns:
- The singleton instance
-
binaryToDecimal
Converts a binary string to a decimal number- Parameters:
binaryString- The binary number as a string- Returns:
- The decimal number
-
decimalToBinary
Converts a decimal number to a binary string- Parameters:
decimalNumber- The decimal number- Returns:
- The binary string
-
decimalToHexadecimal
Converts a decimal number to a hexadecimal string- Parameters:
decimalNumber- The decimal number- Returns:
- The hexadecimal string
-
hexadecimalToDecimal
Converts a hexadecimal string to a decimal number- Parameters:
hexadecimalString- The hexadecimal number as a string- Returns:
- The decimal number
-
decimalToOctal
Converts a decimal number to an octal string- Parameters:
decimalNumber- The decimal number- Returns:
- The octal string
-
octalToDecimal
Converts an octal string to a decimal number- Parameters:
octalString- The octal number as a string- Returns:
- The decimal number
-
decimalToBaseN
Converts a decimal number to a base-n string- Parameters:
decimalNumber- The decimal numberbase- The base- Returns:
- The base-n string
-
baseNToDecimal
Converts a base-n string to a decimal number- Parameters:
baseNString- The base-n number as a stringbase- The base- Returns:
- The decimal number
-
binaryToOctal
Converts a binary string to an octal string- Parameters:
binaryString- The binary string- Returns:
- The octal string
-
octalToBinary
Converts an octal string to a binary string- Parameters:
octalString- The octal string- Returns:
- The binary string
-
binaryToHexadecimal
Converts a binary string to a hexadecimal string- Parameters:
binaryString- The binary string- Returns:
- The hexadecimal string
-
hexadecimalToBinary
Converts a hexadecimal string to a binary string- Parameters:
hexadecimalString- The hexadecimal string- Returns:
- The binary string
-
binaryToBaseN
Binary to base n string.- Parameters:
binaryString- the binary stringbase- the base- Returns:
- the string
-
octalToHexadecimal
Octal to hexadecimal string.- Parameters:
octalString- the octal string- Returns:
- the string
-
hexadecimalToOctal
Hexadecimal to octal string.- Parameters:
hexadecimalString- the hexadecimal string- Returns:
- the string
-
octalToBaseN
Octal to base n string.- Parameters:
octalString- the octal stringbase- the base- Returns:
- the string
-
hexadecimalToBaseN
Hexadecimal to base n string.- Parameters:
hexadecimalString- the hexadecimal stringbase- the base- Returns:
- the string
-
baseNToBaseK
Base n to base k string.- Parameters:
baseNString- the base n stringbaseN- the base nbaseK- the base k- Returns:
- the string
-