public boolean isNumber(String s) {

    s = s.trim();
    if (s.length() > 0 && s.charAt(s.length() - 1) == 'e') {
      return false; // avoid "3e" which is false
    }
    String[] t = s.split("e");
    if (t.length == 0 || t.length > 2) {
      return false;
    }
    boolean res = valid(t[0], false);
    if (t.length > 1) {
      res = res && valid(t[1], true);
    }
    return res;
  }