Convert Binary String to Decimal Number using Java

Integer.parseInt method

package app;

public class Main
{
    public static void main(String[] args)
    {
        String binaryString = "10100";
        int decimalNumber = Integer.parseInt(binaryString, 2);

        System.out.println(decimalNumber);
    }
}

Leave a Comment

Cancel reply

Your email address will not be published.