public static UTMPoint LLtoUTM(LatLonPoint llpoint, Ellipsoid ellip, UTMPoint utmpoint) {  double Lat = llpoint.getLatitude(); double Long = llpoint.getLongitude(); double a = ellip.radius; double eccSquared = ellip.eccsq; double k0 = 0.9996;  double LongOrigin; double eccPrimeSquared; double N, T, C, A, M;  double LatRad = llpoint.radlat_; double LongRad = llpoint.radlon_; double LongOriginRad; int ZoneNumber;  ZoneNumber = (int) ((Long + 180) / 6) + 1;   if (Long == 180) { ZoneNumber = 60; }   if (Lat >= 56.0f && Lat < 64.0f && Long >= 3.0f && Long < 12.0f) { ZoneNumber = 32; }   if (Lat >= 72.0f && Lat < 84.0f) { if (Long >= 0.0f && Long < 9.0f) ZoneNumber = 31; else if (Long >= 9.0f && Long < 21.0f) ZoneNumber = 33; else if (Long >= 21.0f && Long < 33.0f) ZoneNumber = 35; else if (Long >= 33.0f && Long < 42.0f) ZoneNumber = 37; } LongOrigin = (ZoneNumber - 1) * 6 - 180 + 3;   LongOriginRad = ProjMath.degToRad(LongOrigin);  eccPrimeSquared = (eccSquared) / (1 - eccSquared);  N = a / Math.sqrt(1 - eccSquared * Math.sin(LatRad) * Math.sin(LatRad)); T = Math.tan(LatRad) * Math.tan(LatRad); C = eccPrimeSquared * Math.cos(LatRad) * Math.cos(LatRad); A = Math.cos(LatRad) * (LongRad - LongOriginRad);  M = a * ((1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256) * LatRad - (3 * eccSquared / 8 + 3 * eccSquared * eccSquared / 32 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(2 * LatRad) + (15 * eccSquared * eccSquared / 256 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(4 * LatRad) - (35 * eccSquared * eccSquared * eccSquared / 3072) * Math.sin(6 * LatRad));  float UTMEasting = (float) (k0 * N * (A + (1 - T + C) * A * A * A / 6.0d + (5 - 18 * T + T * T + 72 * C - 58 * eccPrimeSquared) * A * A * A * A * A / 120.0d) + 500000.0d);  float UTMNorthing = (float) (k0 * (M + N * Math.tan(LatRad) * (A * A / 2 + (5 - T + 9 * C + 4 * C * C) * A * A * A * A / 24.0d + (61 - 58 * T + T * T + 600 * C - 330 * eccPrimeSquared) * A * A * A * A * A * A / 720.0d))); if (Lat < 0.0f) { UTMNorthing += 10000000.0f;  }  if (utmpoint == null) { utmpoint = new UTMPoint(); }  utmpoint.northing = (float) Math.rint(UTMNorthing); utmpoint.easting = (float) Math.rint(UTMEasting); utmpoint.zone_number = ZoneNumber; utmpoint.zone_letter = utmpoint.getLetterDesignator(Lat);  return utmpoint;
public static UTMPoint LLtoUTM(LatLonPoint llpoint) { return LLtoUTM(llpoint, Ellipsoid.WGS_84, new UTMPoint());
    public static UTMPoint LLtoUTM(LatLonPoint llpoint, Ellipsoid ellip,                                   UTMPoint utmpoint) {        double Lat = llpoint.getLatitude();        double Long = llpoint.getLongitude();        double a = ellip.radius;        double eccSquared = ellip.eccsq;        double k0 = 0.9996;        double LongOrigin;        double eccPrimeSquared;        double N, T, C, A, M;        double LatRad = llpoint.radlat_;        double LongRad = llpoint.radlon_;        double LongOriginRad;        int ZoneNumber;        ZoneNumber = (int) ((Long + 180) / 6) + 1;        //Make sure the longitude 180.00 is in Zone 60        if (Long == 180) {            ZoneNumber = 60;        }        // Special zone for Norway        if (Lat >= 56.0f && Lat < 64.0f && Long >= 3.0f && Long < 12.0f) {            ZoneNumber = 32;        }        // Special zones for Svalbard        if (Lat >= 72.0f && Lat < 84.0f) {            if (Long >= 0.0f && Long < 9.0f)                ZoneNumber = 31;            else if (Long >= 9.0f && Long < 21.0f)                ZoneNumber = 33;            else if (Long >= 21.0f && Long < 33.0f)                ZoneNumber = 35;            else if (Long >= 33.0f && Long < 42.0f)                ZoneNumber = 37;        }        LongOrigin = (ZoneNumber - 1) * 6 - 180 + 3; //+3 puts origin                                                     // in middle of                                                     // zone        LongOriginRad = ProjMath.degToRad(LongOrigin);        eccPrimeSquared = (eccSquared) / (1 - eccSquared);        N = a / Math.sqrt(1 - eccSquared * Math.sin(LatRad) * Math.sin(LatRad));        T = Math.tan(LatRad) * Math.tan(LatRad);        C = eccPrimeSquared * Math.cos(LatRad) * Math.cos(LatRad);        A = Math.cos(LatRad) * (LongRad - LongOriginRad);        M = a                * ((1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5                        * eccSquared * eccSquared * eccSquared / 256)                        * LatRad                        - (3 * eccSquared / 8 + 3 * eccSquared * eccSquared                                / 32 + 45 * eccSquared * eccSquared                                * eccSquared / 1024)                        * Math.sin(2 * LatRad)                        + (15 * eccSquared * eccSquared / 256 + 45 * eccSquared                                * eccSquared * eccSquared / 1024)                        * Math.sin(4 * LatRad) - (35 * eccSquared * eccSquared                        * eccSquared / 3072)                        * Math.sin(6 * LatRad));        float UTMEasting = (float) (k0                * N                * (A + (1 - T + C) * A * A * A / 6.0d + (5 - 18 * T + T * T                        + 72 * C - 58 * eccPrimeSquared)                        * A * A * A * A * A / 120.0d) + 500000.0d);        float UTMNorthing = (float) (k0 * (M + N                * Math.tan(LatRad)                * (A * A / 2 + (5 - T + 9 * C + 4 * C * C) * A * A * A * A                        / 24.0d + (61 - 58 * T + T * T + 600 * C - 330 * eccPrimeSquared)                        * A * A * A * A * A * A / 720.0d)));        if (Lat < 0.0f) {            UTMNorthing += 10000000.0f; //10000000 meter offset for                                        // southern hemisphere        }        if (utmpoint == null) {            utmpoint = new UTMPoint();        }        utmpoint.northing = (float) Math.rint(UTMNorthing);        utmpoint.easting = (float) Math.rint(UTMEasting);        utmpoint.zone_number = ZoneNumber;        utmpoint.zone_letter = utmpoint.getLetterDesignator(Lat);        return utmpoint;    }