public static <A,E extends A>A[] toArray(Enumeration<E> enumeration,A[] array){
  ArrayList<A> elements=new ArrayList<A>();
  while (enumeration.hasMoreElements()) {
    elements.add(enumeration.nextElement());
  }
  return elements.toArray(array);
}

public static < A , E extends A > A [ ] toArray ( Enumeration < E > enumeration , A [ ] array ) { ArrayList < A > elements = new ArrayList < A > ( ) ; while ( enumeration . hasMoreElements ( ) ) { elements . add ( enumeration . nextElement ( ) ) ; } return elements . toArray ( array ) ; }
marshal the elements from the given enumeration into an array of the given type . enumeration elements must be assignable to the type of the given array . the array returned will be a different instance than the array given .
