How to convert a String consisting of Binary Number to Hexa Decimal no in Java? -
my string 010101010111111111101010101010101010111101010101010101010101 , large in size (more 64 characters).
i cannot use integer or long class parse methods due size limitation.
expected output 557feaaaaf55555h.
use biginteger this:
string s = "010101010111111111101010101010101010111101010101010101010101"; biginteger value = new biginteger(s, 2); system.out.println(value.tostring(16)); this shows:
557feaaaaf55555 or exact output:
system.out.println(value.tostring(16).touppercase() + "h");
Comments
Post a Comment