I'm doing a code generator app, I need to generate a hexadecimal code from the code entered by the user and show this generated hexadecimal code. Could someone explain to me how I can get to this? I'm a beginner in this area.
I'm doing a code generator app, I need to generate a hexadecimal code from the code entered by the user and show this generated hexadecimal code. Could someone explain to me how I can get to this? I'm a beginner in this area.
If you have a string with any number, for example:
String str = "43956";
You must first convert this to an integer, like this:
int num = Integer.valueOf(str).intValue();
You can then convert this number to a string of hexadecimal digits, like this:
String hex = Integer.toHexString(num);
Now it's a matter of organizing your UI to display this value.
Documentation:
Integer.valueOf(String s)
Integer.intValue()
Integer.toHexString(int i)