How to convert decimal primitive int to hexadecimal number in String object in Java

1 Answer

0 votes
package javaapplication1;

public class JavaApplication1 {

    public static void main(String[] args) {

        int decimal = 15;

        String sHex = Integer.toHexString(decimal);
               
        System.out.println(sHex);
    }
}
   
/*
      
run:
      
f
  
*/

 



answered Nov 6, 2016 by avibootz
...