2
I’m making a code generator app, I need to generate a hexadecimal code from the code typed 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.
2
I’m making a code generator app, I need to generate a hexadecimal code from the code typed 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.
1
If you have a string with any number, for example:
String str = "43956";
You must first convert this to an integer number, so:
int num = Integer.valueOf(str).intValue();
Then you can convert that 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 that value.
The documentations:
Integer.valueOf(String s)
Integer.intValue()
Integer.toHexString(int i)
Browser other questions tagged android hexadecimal
You are not signed in. Login or sign up in order to post.
In what language? In languages that understand printf() masks, you could do something like printf("%x", number);
– epx
At first the solution of this question (http://stackoverflow.com/questions/923863/converting-a-string-to-hexadecimal-in-java) works, has tried already?
– Wakim