方法substring里,参数要非负!

解决方案 »

  1.   

    恩,谢谢
    我也找到这里来了,但就是想来想去,似乎并没有什么问题
    楼上的看看我这个IPLocalizer.java:186 里这段代码是否正确?        int from = 0;
            int end = ip.indexOf(".", from);
            int ip3 = Integer.parseInt(ip.substring(from, end));
            from = end + 1;
            end = ip.indexOf(".", from);
            int ip2 = Integer.parseInt(ip.substring(from, end));
            from = end + 1;
            end = ip.indexOf(".", from);
            int ip1 = Integer.parseInt(ip.substring(from, end));
            int ip0 = Integer.parseInt(ip.substring(end + 1));
      

  2.   

    int end = ip.indexOf(".", from); 
    错了吧?异常应该是  int ip3 = Integer.parseInt(ip.substring(from, end));  抛出的吧