For example, a=? b=? c=?
How do you get a,b,c? Do they come double?

解决方案 »

  1.   

    a,b,c是sha-1加密后的的结果,160位
    double类型好像也表示不出来,
    曾经想过把字符串拆成10份,再比较,不知道可不可行。
      

  2.   

    //      String a = "7faf123";
    //      String b = "ffaf123";
    //      String c = "ffaf123";
          // assume a,b,c has the same length
          public static void S(String a, String b, String c) {
             a = a.toUpperCase();b = b.toUpperCase();c = c.toUpperCase();
             for(int i = 0; i < b.length(); i++) {
                int va = Integer.parseInt(""+a.charAt(i),16);
                int vb = Integer.parseInt(""+b.charAt(i),16);
                int vc = Integer.parseInt(""+c.charAt(i),16);
                if(Math.abs(vb-va)==Math.abs(vb-vc))
                    continue;
                else if(Math.abs(vb-va)>Math.abs(vb-vc))
                    System.out.println("c is closer");
                else
                   System.out.println("a is closer");
                return;
             }
             System.out.println("a and c are equal.");
          }
      

  3.   

    indexOf()
    byte 
    可以用吧