Source Code:
public class P8 {
public static void main(String[] args) {
String bin = “101”;
int dec = Integer.parseInt(bin, 2);
System.out.println(dec);
}
}
Output:
public class P8 {
public static void main(String[] args) {
String bin = “101”;
int dec = Integer.parseInt(bin, 2);
System.out.println(dec);
}
}