Reputation: 233
I am doing a method that can convert a int number to hexadecimal string. Basically my code is work for all test, but I am still looking for an efficient way to get rid of the array part. Anyone would give me a hand? the better way for not using array, but rather use a string type would be more efficient, and the answer is very clear as above. So i just delete my original code
Upvotes: 0
Views: 269
Reputation: 1
I Think the Integer.toHexString(int) is the best way to fix your problem
Upvotes: 0
Reputation: 4213
String digits = "0123456789ABCDEF";
output = digits.charAt(remain) + output;
I hope there are no convertion problems.
Upvotes: 1
Reputation: 817
Integer.toHexString(int);
Should be what you are looking for
Upvotes: 2