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

Popular posts from this blog

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -