Decimal to binary

The problem

Write a program that prompts the user to enter a decimal integer and displays its corresponding binary value. Use Java’s Integer.toBinaryString(int) in this program.

Breaking it down

public static void main(String[] strings) {

    Scanner input = new Scanner(System.in);

    System.out.print("Enter an integer: ");
    int number = input.nextInt();

    input.close();

    System.out.println(Integer.toBinaryString(number));
}

Output

Enter an integer: 100
1100100