Package mathvoyage

Class vmath.baseConverter

java.lang.Object
mathvoyage.vmath.baseConverter
Enclosing class:
vmath

public static class vmath.baseConverter extends Object
Contains functions to convert numbers from one base to another.
Author:
Adib Sakhawat
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    binToDec(String bineryNumber)
    Converts a binery number (string) to decimal number (double).
    static String
    binToHex(String binaryString)
    Converts a binary number (string) to a hexadecimal number (string).
    static String
    binToN(String binaryString, int base)
    Converts a binary number (string) to a number of any base (string).
    static String
    binToOct(String binaryString)
    Converts a binary number (string) to an octal number (string).
    static String
    decToBin(double decimalNumber)
    Converts a decimal number (double) to binery number (string).
    static String
    decToHex(double decimalNumber)
    Converts a decimal number (double) to Hexadecimal number (string).
    static String
    decToN(double decimalNumber, int base)
    Converts a decimal number (double) to a number of any base (string).
    static String
    decToOct(double decimalNumber)
    Converts a decimal number (double) to Octal number (string).
    static String
    hexToBin(String hexadecimalString)
    Converts a hexadecimal number (string) to a binary number (string).
    static double
    hexToDec(String hexadecimalString)
    Converts a Hexadecimal number (string) to decimal number (double).
    static String
    hexToN(String hexadecimalString, int base)
    Converts a number from hexadecimal to any base
    static String
    hexToOct(String hexadecimalString)
    Converts a number from hexadecimal to octal
    static double
    nToDec(String number, int base)
    Converts a number of any base (string) to a decimal number (double).
    static String
    nToK(String baseNString, int baseN, int baseK)
    Converts a number from any base to any base
    static String
    octToBin(String octalString)
    Converts an octal number (string) to a binary number (string).
    static double
    octToDec(String octalString)
    Converts an Octal number (String) to a Decimal number (double).
    static String
    octToHex(String octalString)
    Converts a number from octal to hexadecimal
    static String
    octToN(String octalString, int base)
    Converts a number from octal to any base

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • baseConverter

      public baseConverter()
  • Method Details

    • binToDec

      public static double binToDec(String bineryNumber)
      Converts a binery number (string) to decimal number (double).
      Parameters:
      bineryNumber - The binery number in string format
      Returns:
      The decimal number
    • decToBin

      public static String decToBin(double decimalNumber)
      Converts a decimal number (double) to binery number (string).
      Parameters:
      decimalNumber - The decimal number
      Returns:
      The binery number in string format
    • decToHex

      public static String decToHex(double decimalNumber)
      Converts a decimal number (double) to Hexadecimal number (string).
      Parameters:
      decimalNumber - The decimal number
      Returns:
      The Hexadecimal number in string format
    • hexToDec

      public static double hexToDec(String hexadecimalString)
      Converts a Hexadecimal number (string) to decimal number (double).
      Parameters:
      hexadecimalString - The Hexadecimal number in string format
      Returns:
      The decimal number
    • octToDec

      public static double octToDec(String octalString)
      Converts an Octal number (String) to a Decimal number (double).
      Parameters:
      octalString - The decimal number
      Returns:
      The Octal number in string format
    • decToOct

      public static String decToOct(double decimalNumber)
      Converts a decimal number (double) to Octal number (string).
      Parameters:
      decimalNumber - The decimal number
      Returns:
      The Octal number in string format
    • decToN

      public static String decToN(double decimalNumber, int base)
      Converts a decimal number (double) to a number of any base (string).
      Parameters:
      decimalNumber - the decimal number
      base - the base
      Returns:
      The number in string format
    • nToDec

      public static double nToDec(String number, int base)
      Converts a number of any base (string) to a decimal number (double).
      Parameters:
      number - the number
      base - the base
      Returns:
      The decimal number
    • binToOct

      public static String binToOct(String binaryString)
      Converts a binary number (string) to an octal number (string).
      Parameters:
      binaryString - the binary string
      Returns:
      string
    • octToBin

      public static String octToBin(String octalString)
      Converts an octal number (string) to a binary number (string).
      Parameters:
      octalString - the octal string
      Returns:
      The binary number in string format
    • binToHex

      public static String binToHex(String binaryString)
      Converts a binary number (string) to a hexadecimal number (string).
      Parameters:
      binaryString - the binary string
      Returns:
      The hexadecimal number in string format
    • hexToBin

      public static String hexToBin(String hexadecimalString)
      Converts a hexadecimal number (string) to a binary number (string).
      Parameters:
      hexadecimalString - the hexadecimal string
      Returns:
      The binary number in string format
    • binToN

      public static String binToN(String binaryString, int base)
      Converts a binary number (string) to a number of any base (string).
      Parameters:
      binaryString - the binary string
      base - the base
      Returns:
      The number in string format
    • octToHex

      public static String octToHex(String octalString)
      Converts a number from octal to hexadecimal
      Parameters:
      octalString - the octal string
      Returns:
      The hexadecimal number in string format
    • hexToOct

      public static String hexToOct(String hexadecimalString)
      Converts a number from hexadecimal to octal
      Parameters:
      hexadecimalString - the hexadecimal string
      Returns:
      The octal number in string format
    • octToN

      public static String octToN(String octalString, int base)
      Converts a number from octal to any base
      Parameters:
      octalString - the octal string
      base - the base
      Returns:
      The number in string format
    • hexToN

      public static String hexToN(String hexadecimalString, int base)
      Converts a number from hexadecimal to any base
      Parameters:
      hexadecimalString - the hexadecimal string
      base - the base
      Returns:
      The number in string format
    • nToK

      public static String nToK(String baseNString, int baseN, int baseK)
      Converts a number from any base to any base
      Parameters:
      baseNString - the base n string
      baseN - the base n
      baseK - the base k
      Returns:
      The binary number in string format