void type not allowed here error fix in java
import java.util.Scanner;
public class Converter{
public static void toBinary(int x) {
String binary = "";
while (x > 2 ){
binary = (x%2) + binary;
x /= 2;
}
}
}
public class Program {
public static void main(String[ ] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
System.out.print(Converter.toBinary(x));
}
}