public static List primitiveArrayToList ( Object array ) { int size = Array . getLength ( array ) ; List list = new ArrayList ( size ) ; for ( int i = 0 ; i < size ; i ++ ) { Object item = Array . get ( array , i ) ; if ( item != null && item . getClass ( ) . isArray ( ) && item . getClass ( ) . getComponentType ( ) . isPrimitive ( ) ) { item = primitiveArrayToList ( item ) ; } list . add ( item ) ; } return list ; }
Allows conversion of arrays into a mutable List