- 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
Java Program to convert decimal integer to hexadecimal number
Use the toHexString() method to convert decimal to hexadecimal. The method returns a string representation of the integer argument as an unsigned integer in base 16. The following characters are used as hexadecimal digits:0123456789abcdef.
The following is the syntax.
String toHexString(int i)
It has only single parameter.
- i − This is an integer to be converted to a string.
Example
public class Demo { public static void main( String args[] ) { int dec = 45; System.out.println("Decimal = "+dec); // converting to hex System.out.println(Integer.toHexString(dec)); } }
Output
Decimal = 45 2d
- Related Articles
- Convert decimal integer to hexadecimal number in Java
- Java program to convert decimal number to hexadecimal number
- Java Program to convert hexadecimal number to decimal number
- Java Program to convert integer to hexadecimal
- Java Program to convert decimal integer to octal number
- Java Program to convert from decimal to hexadecimal
- 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
- How to convert Decimal to Hexadecimal in Java
- How to Convert Decimal to Hexadecimal?
- How to Convert Hexadecimal to Decimal?
- Java Program to convert binary number to decimal number

Advertisements