Javatpoint Logo
Javatpoint Logo

Duodecimal in Java

In the number system, the Duodecimal number is a number having a base of 12. In Java, we can use predefined or user-defined methods to either find the duodecimal number of binary, octal, decimal, and hexadecimal numbers or to convert duodecimal numbers into other base numbers.

These are some examples of duodecimal numbers.

  1. The duodecimal number(15b)12 is equal to the binary number (11010111)2.
  2. The duodecimal number (182)12 is equal to the octal number (362)8.
  3. The duodecimal number (262)12 is equal to the decimal number (362)10.
  4. The duodecimal number (288052)12 is equal to the hexadecimal number (A563E)16.
  5. The duodecimal number (58576a2)12 is equal to the hexatrigesimal number (A563E)32.

Steps to find duodecimal number

These are the following steps to find the duodecimal number of the given number of any base:

  1. Take a hexadecimal number from the user as an input.
  2. Create a user-defined method to convert it into decimal.
  3. We also create a user-defined function that takes the decimal number and converts it into duodecimal
  4. Return the duodecimal number.

Let's implement the logic to convert a hexadecimal number into a duodecimal number:


Duodecimal in Java

In order to convert other base numbers except for hexadecimal, we have to create other user-defined methods like the convertToDec() method, which will convert the given number into decimal and return it for calculating the duodecimal number.

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA