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  w w. j  a  v  a  2s .  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;
    }
}