How to convert decimal to hexadecimal in Java

1 Answer

0 votes
import java.lang.Integer;

public class MyClass {
    public static void main(String args[]) {
        Integer i = 255;
        String hex = Integer.toHexString(i);
        
        System.out.println(hex);  
    }
}





/*
run:
  
ff
  
*/

 



answered Aug 14, 2021 by avibootz
...