Discuss / Java / 只会做第一题

只会做第一题

Topic source

笑川之主

#1 Created at ... [Delete] [Delete and Lock User]
public static void main(String[] args) {    String hex = toHex(12500);    System.out.println(hex);    if (hex.equalsIgnoreCase("30D4")) {        System.out.println("测试通过");    } else {        System.out.println("测试失败");    }}static String toHex(int n) {    Stack stake=new Stack<Character>();    do {        stake.push(Integer.toHexString(n%16));        n=n/16;    }while (n!=0);    String s="";    while (!stake.isEmpty()){        s=s+stake.pop();    }    return s;}

  • 1

Reply