Convert decimal integer to hexadecimal number - Java Language Basics

Java examples for Language Basics:int

Description

Convert decimal integer to hexadecimal number

Demo Code

public class Main {
 
        public static void main(String[] args) {
               /*from ww w  .  j  ava  2s  . com*/
                int i = 32;
               
                String strHexNumber = Integer.toHexString(i);
               
                System.out.println("Convert decimal number to hexadecimal number example");
                System.out.println("Hexadecimal value of " + i + " is " + strHexNumber);
                                                       
        }
}

Result


Related Tutorials