private long checkZone(String MGRSString){
  int i=0;
  int j=0;
  int num_digits=0;
  long error_code=MGRS_NO_ERROR;
  while (i < MGRSString.length() && MGRSString.charAt(i) == ' ') {
    i++;
  }
  j=i;
  while (i < MGRSString.length() && Character.isDigit(MGRSString.charAt(i))) {
    i++;
  }
  num_digits=i - j;
  if (num_digits > 2)   error_code|=MGRS_STRING_ERROR;
 else   if (num_digits <= 0)   error_code|=MGRS_NOZONE_WARNING;
  return error_code;
}

private long checkZone ( String MGRSString ) { int i = 0 ; int j = 0 ; int num_digits = 0 ; long error_code = MGRS_NO_ERROR ; while ( i < MGRSString . length ( ) && MGRSString . charAt ( i ) == ' ' ) { i ++ ; } j = i ; while ( i < MGRSString . length ( ) && Character . isDigit ( MGRSString . charAt ( i ) ) ) { i ++ ; } num_digits = i - j ; if ( num_digits > 2 ) error_code |= MGRS_STRING_ERROR ; else if ( num_digits <= 0 ) error_code |= MGRS_NOZONE_WARNING ; return error_code ; }
the function check_zone receives an mgrs coordinate string . if a zone is given , mgrs_no_error is returned . otherwise , mgrs_nozone_warning . is returned .
