日期:2014-05-20 浏览次数:20627 次
package test; import java.util.Scanner; public class Test { public static void main(String[] e) { Scanner scan = new Scanner(System.in); System.out.println("Please enter an integer number:"); while(true){ int i = scan.nextInt(); if(i > 0){ System.out.println("In binary:" + Integer.toBinaryString(i)); System.out.println("Would you like to continue? (0 or negative for NO)"); }else{ System.out.println("Bye"); break; } } } }