import java.util.Scanner;
public class test {
public static String decimalToBinary(int value) {
long binary=0;
int i=0,j;
long binaries[];
binaries=new long[100000];
while(value!=0)
{
binaries[i]=value%2;
value/=2;
i++;
}
for(j=i-1;j>=0;j--)
{
binary+= binaries[j]*(int) Math.pow(10,j);
}
System.out.println(binary);
return Long.toString(binary);
}
public static void main(String[] args){
while(true){
int i=1000000000;
System.out.println(i);
System.out.print("Enter an integer");
Scanner s=new Scanner(System.in);
int num=s.nextInt();
System.out.println("The binary value is"+decimalToBinary(num));}
}
}
如上,求问大佬