String seasting = null; String snorthing = null;
    protected void decode(String mgrsString) throws NumberFormatException {        if (mgrsString == null || mgrsString.length() == 0) {            throw new NumberFormatException("MGRSPoint coverting from nothing");        }        int length = mgrsString.length();        String hunK = null;        String seasting = null;        String snorthing = null;        StringBuffer sb = new StringBuffer();        char testChar;        int i = 0;        // get Zone number        while (!Character.isLetter(testChar = mgrsString.charAt(i))) {            if (i > 2) {                throw new NumberFormatException("MGRSPoint bad conversion from: "                        + mgrsString);            }            sb.append(testChar);            i++;        }        zone_number = Integer.parseInt(sb.toString());        if (i == 0 || i + 3 > length) {            // A good MGRS string has to be 4-5 digits long,            // ##AAA/#AAA at least.            throw new NumberFormatException("MGRSPoint bad conversion from: "                    + mgrsString);        }        zone_letter = mgrsString.charAt(i++);        // Should we check the zone letter here? Why not.        if (zone_letter <= 'A' || zone_letter == 'B' || zone_letter == 'Y'                || zone_letter >= 'Z' || zone_letter == 'I'                || zone_letter == 'O') {            throw new NumberFormatException("MGRSPoint zone letter "                    + (char) zone_letter + " not handled: " + mgrsString);        }        hunK = mgrsString.substring(i, i += 2);        int set = get100kSetForZone(zone_number);        float east100k = getEastingFromChar(hunK.charAt(0), set);        float north100k = getNorthingFromChar(hunK.charAt(1), set);        // We have a bug where the northing may be 2000000 too low.        // How        // do we know when to roll over?        while (north100k < getMinNorthing(zone_letter)) {            north100k += 2000000;        }        // calculate the char index for easting/northing separator        int remainder = length - i;        if (remainder % 2 != 0) {            throw new NumberFormatException("MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters"                    + mgrsString);        }        int sep = remainder / 2;        float sepEasting = 0f;        float sepNorthing = 0f;        if (sep > 0) {            if (DEBUG)                Debug.output(" calculating e/n from " + mgrs.substring(i));            float accuracyBonus = 100000f / (float) Math.pow(10, sep);            if (DEBUG)                Debug.output(" calculated accuracy bonus as  " + accuracyBonus);            String sepEastingString = mgrsString.substring(i, i + sep);            if (DEBUG)                Debug.output(" parsed easting as " + sepEastingString);            sepEasting = Float.parseFloat(sepEastingString) * accuracyBonus;            String sepNorthingString = mgrsString.substring(i + sep);            if (DEBUG)                Debug.output(" parsed northing as " + sepNorthingString);            sepNorthing = Float.parseFloat(sepNorthingString) * accuracyBonus;        }        easting = sepEasting + east100k;        northing = sepNorthing + north100k;        if (DEBUG) {            Debug.output("Decoded " + mgrsString + " as zone number: "                    + zone_number + ", zone letter: " + zone_letter                    + ", easting: " + easting + ", northing: " + northing                    + ", 100k: " + hunK);        }    }