private void checkFormat() throws IllegalArgumentException {
    if (!format.startsWith("%")) {
      throw new IllegalArgumentException("Number format not starting with %");
    }

    if (!format.endsWith("m")) {
      throw new IllegalArgumentException("Sexagesimal format not recognized (not ending m)");
    }

    String remaining = format.substring(1, format.length() - 1);

    int dotPos = remaining.indexOf(".");

    if (dotPos == -1) {
      throw new IllegalArgumentException("Sexagesimal format not correct (no dot)");
    }

    String l = remaining.substring(0, dotPos);
    String frLength = remaining.substring(dotPos + 1);

    try {
      length = Integer.parseInt(l);
      fractionLength = Integer.parseInt(frLength);
    } catch (NumberFormatException e) {
      throw new IllegalArgumentException("Illegal sexagesimal length or fraction length");
    }

    if ((fractionLength != 3) && (fractionLength != 5) && (fractionLength != 6) && (fractionLength != 8) && (fractionLength != 9)) {
      throw new IllegalArgumentException("Illegal sexagesimal fraction length");
    }
  }