Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created February 26, 2020 19:00
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
public static String decimalAHexadecimal(int decimal) {
String hexadecimal = "";
String caracteresHexadecimales = "0123456789abcdef";
while (decimal > 0) {
int residuo = decimal % 16;
hexadecimal = caracteresHexadecimales.charAt(residuo) + hexadecimal; // Agregar a la izquierda
decimal /= 16;
}
return hexadecimal;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment