public static List<List<Double>> partitionVariable(List<Double> arr,int chunk){
  int count=0;
  List<List<Double>> ret=new ArrayList<List<Double>>();
  while (count < arr.size()) {
    List<Double> sublist=arr.subList(count,count + chunk);
    count+=chunk;
    ret.add(sublist);
  }
  for (  List<Double> lists : ret) {
    if (lists.size() < chunk)     ret.remove(lists);
  }
  return ret;
}

public static List < List < Double > > partitionVariable ( List < Double > arr , int chunk ) { int count = 0 ; List < List < Double > > ret = new ArrayList < List < Double > > ( ) ; while ( count < arr . size ( ) ) { List < Double > sublist = arr . subList ( count , count + chunk ) ; count += chunk ; ret . add ( sublist ) ; } for ( List < Double > lists : ret ) { if ( lists . size ( ) < chunk ) ret . remove ( lists ) ; } return ret ; }
this will partition the given whole variable data applytransformtodestination in to the specified chunk number .
