Java - Write code to convert an Object[] to a String[]

Requirements

Write code to convert an Object[] to a String[]

Demo

//package com.book2s;

public class Main {
    /**// w  ww  . j  a  va2  s . co m
     * convert an Object[] to a String[]
     * 
     * @param oAry
     * @return
     */
    public static String[] toStrArray(Object[] oAry) {
        String[] sAry = new String[oAry.length];
        int cnt = 0;
        for (Object o : oAry)
            sAry[cnt++] = (String) o;
        return sAry;
    }
}