I have a string whose radix has been changed & its value is printed. Is there a way to convert the string back to its original form?
My code looks like:
String b=text2[i].toString(16);
Here text2
array is of BigInteger
type. I want to get the original string from variable b
.
new BigInteger(b, 16).toString();
public static void main(String[] args) {
final BigInteger original = new BigInteger("27");
final String converted = original.toString(16);
final BigInteger convertedBack = new BigInteger(converted, 16);
System.out.println("original = [" + original.toString() + "]");
System.out.println("converted = [" + converted + "]");
System.out.println("convertedBack = [" + convertedBack.toString() + "]");
}
original = [27]
converted = [1b]
convertedBack = [27]