Here you can find the source of toArray(Object foo)
public static Object[] toArray(Object foo)
//package com.java2s; //License from project: Apache License public class Main { public static Object[] toArray(Object foo) { if (foo.getClass().isArray()) { return (Object[]) foo; }//from www . j a v a2 s .c o m return null; } }