public static double[] toUtmX(int zone, double lon, double lat) throws Exception {
        double[] xy = {0, 0};

        if ((lon < -180.0) || (180.0 <= lon)) {
            throw new Exception("The longitude you entered is out of range. "
                    + "Please enter a number in the range [-180, 180).");
        }

        if ((lat < -90.0) || (90.0 < lat)) {
            throw new Exception("The latitude you entered is out of range. "
                    + "Please enter a number in the range [-90, 90].");
        }

        zone = LatLonToUTMXY(DegToRad(lat), DegToRad(lon), zone, xy);
        return xy;
    }