*98*

# Vigesimal in Java

In Java, the **Vigesimal** is a number system having a base of 20. Like Duodecimal numbers, we can use predefined or user-defined methods to either find the equivalent vigesimal number of binary, octal, decimal and hexadecimal numbers or to find the equivalent other base numbers of the given vigesimal number.

These are some examples of vigesimal numbers.

- The vigesimal number(AF)20 is equal to the binary number (11010111)2.
- The vigesimal number (C2)20 is equal to the octal number (362)8.
- The vigesimal number (I2)20 is equal to the decimal number (362)10.
- The vigesimal number (44DBI)20 is equal to the hexadecimal number (A563E)16.
- The vigesimal number (36BJCE)20 is equal to the hexa-trigesimal number (A563E)32.

### Steps to find vigesimal number

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

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

Let’s implement the logic to convert a hexadecimal number into a vigesimal number:

**VigesimalNumber.java**

**Output:**

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 vigesimal number.