code: private void sortPoints() {
  		final ControlPoint firstPt = (ControlPoint)list.get(0);
  		final ControlPoint lastPt  = (ControlPoint)list.get(list.size()-1);
  		Comparator compare = new Comparator() {
  			public int compare(Object first, Object second) {
  				if (first == firstPt) {
  					return -1;
  				}
  				if (second == lastPt) {
  					return -1;
  				}
  				
  				float a = ((ControlPoint) first).pos;
  				float b = ((ControlPoint) second).pos;
  				return (int) ((a-b) * 10000);
  			}
  		};
  		Collections.sort(list, compare);
  	}
docs: Sort the control points based on their position