Java ProgramTo Convert Decimal To Hexadecimal | Vice Versa
Beginners Programs :

Java Program Convert Decimal To Hexadecimal | Vice Versa

Java Program convert Decimal to Hexadecimal vice versa Hexadecimal to Decimal. Here we written the code in three different ways using arrays, static method, recursion, vice versa with sample output and example program. Before get into the programming a couple of lines just to let you know the basics.

  • What is Decimal ?

Decimal number system is term with base 10. It’s most commonly used number system.  The decimal number system consists of 10 digits from 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.

  • What is Hexadecimal ?

Same as like: but with a different numbering system:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

  • How to convert than ?

Conversion is quite simple: Just look at the Image here:

  • Example : Convert the number 256 from decimal to hexadecimal
Division PartResultRemainder
256/16160
16/1610
1/1601
Answer100
  • Example – 2 : Covert 188:

DivisonResultRemainder Part
188/1611C
11/160B
ANS:BC

1. Using Array

Output:
 

2. Static Method

Another example program with sample output: #Static Method.

Output:

3. Using Recursion

  • Another example program using recursion: A function call itself.
Output:
4. Vice versa: convert hexadecimal to Decimal

Here is the Java code program conversion from Hexadecimal to decimal with sample outputs:

Output:

List of other programs: