Java Object Array to String objectArrayToStringArray(Object[][] objects)

Here you can find the source of objectArrayToStringArray(Object[][] objects)

Description

object Array To String Array

License

Apache License

Declaration

public static String[][] objectArrayToStringArray(Object[][] objects) 

Method Source Code

//package com.java2s;
/**/*from   w  w  w  . j  a va  2  s  . c  o  m*/
 * Copyright 2010 
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

public class Main {

    public static String[][] objectArrayToStringArray(Object[][] objects) {
        String[][] array = null;
        if (objects == null) {
            return null;
        }
        int length = objects.length;
        array = new String[length][2];
        for (int i = 0; i < length; i++) {
            array[i][0] = (String) objects[i][0];
            array[i][1] = (String) objects[i][1];
        }
        return array;
    }

    public static String[] objectArrayToStringArray(Object[] objects) {
        String[] array = null;
        if (objects == null) {
            return null;
        }
        int length = objects.length;
        array = new String[length];
        for (int i = 0; i < length; i++) {
            array[i] = (String) objects[i];
        }
        return array;
    }
}

Related

  1. objectArrayToString(String separator, Object... objects)
  2. objectArrayToStringArray(final Object[] objectArray)
  3. objectArrayToStringArray(Object data[])
  4. objectArrayToStringArray(Object[] objectArray)
  5. objectArrayToStringArray(Object[] objs)