JAVA SP T


Lets dive into snapshot of my programs!💻

25.How to convert Binary to Decimal.

💡Code:

public class BinaryToDecimalConversion7078 {
                public static void main(String[] args) {
                    // Example binary string
                    String binaryString = "1101";
            
                    // Convert binary to decimal
                    int decimalValue = Integer.parseInt(binaryString, 2);
            
                    // Print the converted decimal value
                    System.out.println("Converted decimal value: " + decimalValue);
                }
            }
            
           

📸Output :

output