private static String formatPos(final int p) {
        int pLocal = p;
        final boolean negative = pLocal < 0;
        if (negative) {
            pLocal = -pLocal;
        }
        final char[] ac = new char[12];
        int i = 11;
        while (pLocal != 0 || i > 3) {
            ac[i--] = (char) ('0' + (pLocal % 10));
            pLocal /= 10;
            if (i == 5) {
                ac[i--] = '.';
            }
        }
        if (negative) {
            ac[i--] = '-';
        }
        return new String(ac, i + 1, 11 - i);
    }
writes the track in a selected output format to a string

@param t the track to format
@return the formatted string
main/src/main/java/cgeo/geocaching/brouter/core/Formatter.java