+ 4

Number to Hex? In js or java or py.

ÂżComĂł convertir nĂșmero a Hexadecimal?Puede ser en javascript o en python.

25th Jun 2017, 1:37 PM
Benjamin Salas
Benjamin Salas - avatar
4 Answers
+ 14
idk Python, but this how to do it in Java with only one line of code (we use the toHexString() method for this stuff): int x = 42; System.out.print(Integer.toHexString(x)); You can change it as per your choice, to convert a number to binary or octal, you can change it to Integer.toBinaryString(x) and Integer.toOctalString(x) respectively. ^_^
25th Jun 2017, 2:18 PM
Dev
Dev - avatar
+ 4
thanks to both.
25th Jun 2017, 2:53 PM
Benjamin Salas
Benjamin Salas - avatar
+ 3
Javscript: var decimal = 128; alert (Number(decimal).toString(16)); // output 80
25th Jun 2017, 2:40 PM
CalviŐČ
CalviŐČ - avatar
+ 2
Excuse me . Maybe js or py or java. Any. Thanks.
25th Jun 2017, 2:05 PM
Benjamin Salas
Benjamin Salas - avatar