In Java, you can convert a decimal number to binary using Integer.toBinaryString()
public class DecimalToBinary {
public static void main(String[] args) {
int decimal = 25; // Change this to any decimal number you want to convert
String binary = Integer.toBinaryString(decimal);
System.out.println("Decimal: " + decimal);
System.out.println("Binary: " + binary);
}
}
This code takes a decimal number (in this case, 25) and converts it to its binary representation using Integer.toBinaryString().