protected void expandFor(int i1,int i2,double d){
  if (i1 >= sizes.size()) {
    int oldSize=sizes.size(), capacity=vector.length;
    sizes.set(i1,0);
    if (capacity < sizes.size()) {
      while (capacity < sizes.size())       capacity*=2;
      double[][] t=new double[capacity][];
      System.arraycopy(vector,0,t,0,oldSize);
      vector=t;
    }
    for (int i=oldSize; i < sizes.size(); ++i)     vector[i]=new double[defaultCapacity2];
  }
  if (i2 < sizes.get(i1))   return;
  int oldSize=sizes.get(i1), capacity=vector[i1].length;
  sizes.set(i1,i2 + 1);
  if (capacity >= sizes.get(i1))   return;
  while (capacity < sizes.get(i1))   capacity*=2;
  double[] t=new double[capacity];
  System.arraycopy(vector[i1],0,t,0,oldSize);
  if (d != 0)   Arrays.fill(t,oldSize,sizes.get(i1),d);
  vector[i1]=t;
}

protected void expandFor ( int i1 , int i2 , double d ) { if ( i1 >= sizes . size ( ) ) { int oldSize = sizes . size ( ) , capacity = vector . length ; sizes . set ( i1 , 0 ) ; if ( capacity < sizes . size ( ) ) { while ( capacity < sizes . size ( ) ) capacity *= 2 ; double [ ] [ ] t = new double [ capacity ] [ ] ; System . arraycopy ( vector , 0 , t , 0 , oldSize ) ; vector = t ; } for ( int i = oldSize ; i < sizes . size ( ) ; ++ i ) vector [ i ] = new double [ defaultCapacity2 ] ; } if ( i2 < sizes . get ( i1 ) ) return ; int oldSize = sizes . get ( i1 ) , capacity = vector [ i1 ] . length ; sizes . set ( i1 , i2 + 1 ) ; if ( capacity >= sizes . get ( i1 ) ) return ; while ( capacity < sizes . get ( i1 ) ) capacity *= 2 ; double [ ] t = new double [ capacity ] ; System . arraycopy ( vector [ i1 ] , 0 , t , 0 , oldSize ) ; if ( d != 0 ) Arrays . fill ( t , oldSize , sizes . get ( i1 ) , d ) ; vector [ i1 ] = t ; }
makes sure the capacities and sizes of the vectors can accomodate the given indexes . the capacities of the vectors are simply doubled until they can accomodate their sizes .
