- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 integer to hexadecimal
Use the + Integer.toHexString() method in Java to convert integer to hexadecimal.
Let’s say the following is our integer.
int val = 768;
Let us convert it to a hexadecimal value.
Integer.toHexString(val)
The following is the final example with the output.
Example
public class Demo { public static void main(String[] args) { int val = 768; // integer System.out.println("Integer: "+val); // hex System.out.println("Hex String = " + Integer.toHexString(val)); } }
Output
Integer: 768 Hex String = 300
- Related Articles
- Java Program to convert decimal integer to hexadecimal number
- Convert decimal integer to hexadecimal number in Java
- Java Program to convert from decimal to hexadecimal
- Java program to convert decimal number to hexadecimal number
- Java Program to convert hexadecimal number to decimal number
- Java Program to convert integer to boolean
- Java Program to convert boolean to integer
- Java Program to convert integer to octal
- Java Program to convert from integer to String
- Java Program to convert from String to integer
- 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
- How to convert an integer to a hexadecimal string in Python?

Advertisements