private List<Double> toList(double[] x){
  List<Double> result=new ArrayList<Double>();
  for (int i=0; i < x.length; i++) {
    result.add(x[i]);
  }
  return result;
}

private List < Double > toList ( double [ ] x ) { List < Double > result = new ArrayList < Double > ( ) ; for ( int i = 0 ; i < x . length ; i ++ ) { result . add ( x [ i ] ) ; } return result ; }
converts a double array to a list .
