Blogger

Delete comment from: Javarevisited

Anonymous said...

int n = 110101;
String s = "" + n;
s = s.replace("1", "");
s = s.replace("0", "");
if(s.length() == 0)
System.out.print(n + " is binary);
else System.out.print(n + " is not binary");

May 26, 2014, 12:46:36 PM


Posted to How to check if a given Number is Binary in Java? [Solved] Example

Google apps
Main menu