I am trying to add two larger binary numbers (i.e. number of bits are greater than 31) but stuck due to getting NumberFormatException. Below is the line which is throwing exception-
Integer.parseInt(binaryNo, 2);
My idea was to convert both binary numbers into integer first, then adding together after that convert integer to binary back using Integer.toBinaryString(integerSum). But it's not applicable for binary number having bits larger than 31 as integer overflow occurs. Please tell me any way which can perform large binary number addition in optimized way (minimum time). Thank you.