Answer the question
In order to leave comments, you need to log in
How to add binary numbers in JAVA?
How to implement addition of two binary numbers in Java?
For example, there is a number int - 11111010 and you need to add the number to it according to the rules of addition of binary numbers:
00000001. How to do it ?
Answer the question
In order to leave comments, you need to log in
Integer.toBinaryString(Integer.parseInt("11111010", 2) + Integer.parseInt("00000001", 2))
If your number is already int, then take it and add it with the addition operator ("+" for those who skipped math).
Otherwise, translate your (most likely) string representation into int, long or BigInteger, and work with it already.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question