问题出在哪里了?
public class TenToTwo {public static void main(String[] args){
java.util.Scanner input=new java.util.Scanner(System.in);
System.out.println("请输入十进制数:");
String a=input.nextLine();
String s1=reverse(tentotwo(a));
System.out.println(a+"的二进制表示为:"+s1);
}
public static String tentotwo(String a){
StringBuilder stringBuilder=new StringBuilder();
int n=Integer.parseInt(a);
do
{
int yu=n%2;
n=n/2;
stringBuilder.append(yu);
}while(n!=0);
return stringBuilder.toString();
}
public static String reverse(String s){
StringBuilder stringBuilder=new StringBuilder();
stringBuilder.reverse();
return stringBuilder.toString();
}
}