What do you mean by binary number? eg: 10111011 or something else.
And if Junky's guess is correct, then you should be reading that as a String and parsing the input.
Recommended reading: How to ask questions the smart way
junky is correct.
In that case what Daryl posted is correct. You need to read teh input as a String. then you have 2 options to validate the input.
1. Iterate over the String and check each character is a 1 or 0.
2. Parse the String into an int inside a catch statement. If an exception is thrown then the input is not binary.