public void toUPS(double lat,double lon){
  double a=0;
  double t=0;
  double e=0;
  double es=0;
  double rho=0;
  double x;
  double y;
  final double k0=0.994;
  double lambda=lon * Degree;
  double phi=Math.abs(lat * Degree);
  a=6378137.0;
  es=0.00669438d;
  e=Math.sqrt(es);
  t=Math.tan(Math.PI / 4.0 - phi / 2.0) / Math.pow((1.0 - e * Math.sin(phi)) / (1.0 + e * Math.sin(phi)),(e / 2.0));
  rho=2.0 * a * k0* t / Math.sqrt(Math.pow(1.0 + e,1.0 + e) * Math.pow(1.0 - e,1.0 - e));
  x=rho * Math.sin(lambda);
  y=rho * Math.cos(lambda);
  if (lat > 0.0) {
    y=-(y);
  }
  x+=2.0e6;
  y+=2.0e6;
  easting=x;
  northing=y;
}

public void toUPS ( double lat , double lon ) { double a = 0 ; double t = 0 ; double e = 0 ; double es = 0 ; double rho = 0 ; double x ; double y ; final double k0 = 0.994 ; double lambda = lon * Degree ; double phi = Math . abs ( lat * Degree ) ; a = 6378137.0 ; es = 0.00669438d ; e = Math . sqrt ( es ) ; t = Math . tan ( Math . PI / 4.0 - phi / 2.0 ) / Math . pow ( ( 1.0 - e * Math . sin ( phi ) ) / ( 1.0 + e * Math . sin ( phi ) ) , ( e / 2.0 ) ) ; rho = 2.0 * a * k0 * t / Math . sqrt ( Math . pow ( 1.0 + e , 1.0 + e ) * Math . pow ( 1.0 - e , 1.0 - e ) ) ; x = rho * Math . sin ( lambda ) ; y = rho * Math . cos ( lambda ) ; if ( lat > 0.0 ) { y = - ( y ) ; } x += 2.0e6 ; y += 2.0e6 ; easting = x ; northing = y ; }
converts a lat - lon pair to ups point
