Class BaseConverter

java.lang.Object
mathvoyage.NumberSystem.BaseConverter

public class BaseConverter extends Object
The type Base converter.
  • Method Details

    • getInstance

      public static BaseConverter getInstance()
      Returns the singleton instance of this class.
      Returns:
      The singleton instance
    • binaryToDecimal

      public double binaryToDecimal(String binaryString)
      Converts a binary string to a decimal number
      Parameters:
      binaryString - The binary number as a string
      Returns:
      The decimal number
    • decimalToBinary

      public String decimalToBinary(double decimalNumber)
      Converts a decimal number to a binary string
      Parameters:
      decimalNumber - The decimal number
      Returns:
      The binary string
    • decimalToHexadecimal

      public String decimalToHexadecimal(double decimalNumber)
      Converts a decimal number to a hexadecimal string
      Parameters:
      decimalNumber - The decimal number
      Returns:
      The hexadecimal string
    • hexadecimalToDecimal

      public double hexadecimalToDecimal(String hexadecimalString)
      Converts a hexadecimal string to a decimal number
      Parameters:
      hexadecimalString - The hexadecimal number as a string
      Returns:
      The decimal number
    • decimalToOctal

      public String decimalToOctal(double decimalNumber)
      Converts a decimal number to an octal string
      Parameters:
      decimalNumber - The decimal number
      Returns:
      The octal string
    • octalToDecimal

      public double octalToDecimal(String octalString)
      Converts an octal string to a decimal number
      Parameters:
      octalString - The octal number as a string
      Returns:
      The decimal number
    • decimalToBaseN

      public String decimalToBaseN(double decimalNumber, int base)
      Converts a decimal number to a base-n string
      Parameters:
      decimalNumber - The decimal number
      base - The base
      Returns:
      The base-n string
    • baseNToDecimal

      public double baseNToDecimal(String baseNString, int base)
      Converts a base-n string to a decimal number
      Parameters:
      baseNString - The base-n number as a string
      base - The base
      Returns:
      The decimal number
    • binaryToOctal

      public String binaryToOctal(String binaryString)
      Converts a binary string to an octal string
      Parameters:
      binaryString - The binary string
      Returns:
      The octal string
    • octalToBinary

      public String octalToBinary(String octalString)
      Converts an octal string to a binary string
      Parameters:
      octalString - The octal string
      Returns:
      The binary string
    • binaryToHexadecimal

      public String binaryToHexadecimal(String binaryString)
      Converts a binary string to a hexadecimal string
      Parameters:
      binaryString - The binary string
      Returns:
      The hexadecimal string
    • hexadecimalToBinary

      public String hexadecimalToBinary(String hexadecimalString)
      Converts a hexadecimal string to a binary string
      Parameters:
      hexadecimalString - The hexadecimal string
      Returns:
      The binary string
    • binaryToBaseN

      public String binaryToBaseN(String binaryString, int base)
      Binary to base n string.
      Parameters:
      binaryString - the binary string
      base - the base
      Returns:
      the string
    • octalToHexadecimal

      public String octalToHexadecimal(String octalString)
      Octal to hexadecimal string.
      Parameters:
      octalString - the octal string
      Returns:
      the string
    • hexadecimalToOctal

      public String hexadecimalToOctal(String hexadecimalString)
      Hexadecimal to octal string.
      Parameters:
      hexadecimalString - the hexadecimal string
      Returns:
      the string
    • octalToBaseN

      public String octalToBaseN(String octalString, int base)
      Octal to base n string.
      Parameters:
      octalString - the octal string
      base - the base
      Returns:
      the string
    • hexadecimalToBaseN

      public String hexadecimalToBaseN(String hexadecimalString, int base)
      Hexadecimal to base n string.
      Parameters:
      hexadecimalString - the hexadecimal string
      base - the base
      Returns:
      the string
    • baseNToBaseK

      public String baseNToBaseK(String baseNString, int baseN, int baseK)
      Base n to base k string.
      Parameters:
      baseNString - the base n string
      baseN - the base n
      baseK - the base k
      Returns:
      the string