- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Convert decimal integer to hexadecimal number in Java
To convert decimal integer to hexadecimal, use the Integer.toHexString() method. Let’s say the following is our decimal integer.
int decInt = 25;
The following is the usage of the Integer.toHexString() method to convert decimal integer to hexadecimal number.
String myHex = Integer.toHexString(decInt);
The following the complete example.
Example
public class Demo { public static void main(String []args) { int decInt = 25; System.out.println("Decimal Integer = "+decInt); String myHex = Integer.toHexString(decInt); System.out.println("Hexadecimal = "+myHex); } }
Output
Decimal Integer = 25 Hexadecimal = 19
- Related Articles
- Java Program to convert decimal integer to hexadecimal number
- Java program to convert decimal number to hexadecimal number
- Java Program to convert hexadecimal number to decimal number
- How to convert Decimal to Hexadecimal in Java
- Java Program to convert integer to hexadecimal
- Java Program to convert decimal integer to octal number
- Java Program to convert from decimal to hexadecimal
- Convert decimal integer to octal in Java
- How to Convert Decimal to Hexadecimal?
- How to Convert Hexadecimal to Decimal?
- Golang Program to convert Decimal to Hexadecimal
- Golang Program to convert Hexadecimal to Decimal
- Swift Program to convert Hexadecimal to Decimal
- Swift Program to convert Decimal to Hexadecimal
- Haskell Program to convert Decimal to Hexadecimal

Advertisements