code: public static boolean isValidOccurrenceSyntax(String occ) {
          StringTokenizer st = new StringTokenizer(occ, ",");
          while (st.hasMoreTokens()) {
              String cond = st.nextToken().trim().replaceAll(" ", "");
              do {
                  //Number: "n"
                  if (match("^\\d+$", cond)) {
                      if (Integer.valueOf(cond) < 0) // not allowed
                          return false;
                      break;
                  }
                  //Range: "n-m"
                  if (match("^\\d+-\\d+$", cond)) {
                      int from = Integer.valueOf(cond.substring(0, cond.indexOf('-')));
                      int to = Integer.valueOf(cond.substring(cond.indexOf('-') + 1, cond.length()));
                      if (from < 0 || to < 0 || to < from) // not allowed
                          return false;
                      break;
                  }
                  //Smaller than: "<n"
                  if (match("^<\\d+$", cond)) {
                      int n = Integer.valueOf(cond.substring(cond.indexOf('<') + 1, cond.length()));
                      if (n == 0) // not allowed
                          return false;
                      break;
                  }
                  //Greater than: ">n"
                  if (match("^>\\d+$", cond)) {
                      break;
                  }
  
                  return false;
              } while (1 == 0);
          }
  
          return true;
      }
docs: Validates the occurrence value.
  <UL>
  <LI>n : exactly n ;</LI>
  <LI>n - m : n through m ;</LI>
  <LI>&#62; n : greater than n ;</LI>
  <LI>&#60; n : fewer than n ;</LI>
  <LI>default (blank) is &gt; 0 ;</LI>
  </UL>
  Any combination of the preceding values is also
  allowed; for example "1, 3-7, 9, &gt;11".
  @param occ String to validate.
  @return true if valid String provided.