public static Object toComponentTypeArray ( Object val , Class < ? > componentType ) { if ( val != null ) { int len = Array . getLength ( val ) ; Object arr = Array . newInstance ( componentType , len ) ; for ( int i = 0 ; i < len ; i ++ ) { Array . set ( arr , i , Array . get ( val , i ) ) ; } return arr ; } else { return null ; } }
Converts an array of objects to an array of the specified component type .