binaryToInt.java
package com.gmail.vhrushyn;
import java.util.Scanner;
public class main {
public static void main(String[] args) {
System.out.println("input binary number");
Scanner sc = new Scanner(System.in);
long n = sc.nextLong();
// long because of opportunity to type a big number of '1' and '0' (up to 19)
String s = Long.toString(n);
// method 'Long.parseLong(s, 2)' has been found in Internet... use libraries so don't need to invent a bicycle
int a = (int) Long.parseLong(s, 2);
System.out.println(a);
sc.close();
}
}