try{
  Long.parseLong(s)
  //is Number
}catch(NumberFormatException e){
    //is not Number  
}

解决方案 »

  1.   

    判断是否为数字组成的字串
      public static boolean isNumber(String validString){
          byte[] tempbyte=validString.getBytes();
          for(int i=0;i<validString.length();i++) {
              //by=tempbyte[i];
              if((tempbyte[i]==45)&&(i==0)){
               continue;}
              if((tempbyte[i]<48)||(tempbyte[i]>57)){
                  return false;
              }
          }
          return true;
      }