Java program to convert binary to decimal


Program
import java.util.*; public class BinaryToDecimal{ public static void main(String args[]){ Scanner s=new Scanner(System.in); System.out.println("Enter a binary number to convert it into decimal"); String binary=s.next(); int decimal=Integer.parseInt(binary,2); System.out.println(decimal); }}
Input
Output