public class Point3d implements Comparable { public double x, y, z; public Point3d() { this(0.0,0.0,0.0); } public Point3d( double _x, double _y, double _z) { this.x = _x; this.y = _y; this.z = _z; } public int compareTo(Object o) { Point3d other = (Point3d)o; if (x < other.x) { return -1; } else if (x > other.x) { return 1; } else { return 0; } } }