Java Program to Convert From Octal to Hexadecimal Number

Java program to convert from octal to hexadecimal number. In a java program, convert an octal number to a hexadecimal number. This isn’t your typical octal to hexadecimal converter. The octal numeral system, also known as oct, is a base-8 numbering system that employs the digits 0 through 7. By grouping consecutive binary digits into groups of three, octal numerals can be generated from binary numerals. Relating to or using a system of numerical notation with a foundation of 16 rather than 10.

The Hexadecimal Number System is a type of numerical representation with the number 16 as the base number. That means there are only 16 possible digit values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Only four bits are required to express the value of any digit.

Octal Function in Java

The octal numeral system, sometimes known as oct, is a base-8 numbering system that use the numerals 0 through 7. By arranging consecutive binary digits into groups of three, octal numerals can be created from binary numerals (starting from the right). The binary representation of decimal 74, for example, is 1001010.

import java.util.Scanner;
public class Main
{
public static void main(String args[])
{
int decimalnum;
Scanner scan = new Scanner(System.in);
System.out.print("Enter Octal Number ");
octalnumber = scan.nextLine();
decimalnum = Integer.parseInt(octalnumber, 8);