private Object newBuffer(Object template) {
    if(template instanceof Object[])
      return new Object [((Object[]) template).length] ;

    if(template instanceof byte[])
      return new byte [((byte[]) template).length] ;

    if(template instanceof char[])
      return new char [((char[]) template).length] ;

    if(template instanceof short[])
      return new short [((short[]) template).length] ;

    if(template instanceof boolean[])
      return new boolean [((boolean[]) template).length] ;

    if(template instanceof int[])
      return new int [((int[]) template).length] ;

    if(template instanceof long[])
      return new long [((long[]) template).length] ;

    if(template instanceof float[])
      return new float [((float[]) template).length] ;

    if(template instanceof double[])
      return new double [((double[]) template).length] ;

    return null ;
  }