how to convert e notation to decimal java code example

Example 1: Java convert hex to decimal

public class ConvertHexToDecimal
{
   public static void main(String[] args)
   {
      String strHex = "b";
      int decimal = Integer.parseInt(strHex, 16);
      System.out.println("Decimal number : " + decimal);
   }
}

Example 2: Java convert octal to decimal

public class OctalToDecimalDemo
{
   public static void main(String[] args)
   {
      String strOctal = "141";
      // converting octal to decimal number using Integer.parseInt() method
      int decimal = Integer.parseInt(strOctal, 8);
      System.out.println(decimal);
   }
}

Tags:

Java Example