Java Object Array to String objectArrayToString(Object[] arr, String name)

Here you can find the source of objectArrayToString(Object[] arr, String name)

Description

Convert an object array to a string, suitable for use in toString methods of the *Stat classes.

License

Open Source License

Return

Description of the Return Value

Declaration

public static String objectArrayToString(Object[] arr, String name) 

Method Source Code

//package com.java2s;
/*-//  w w  w  . j  av  a 2s.c o m
 * See the file LICENSE for redistribution information.
 *
 * Copyright (c) 2001, 2010 Oracle and/or its affiliates.  All rights reserved.
 *
 * $Id$
 */

public class Main {
    /**
     *  Convert an object array to a string, suitable for use in
     *  toString methods of the *Stat classes.
     *
     * @return    Description of the Return Value
     */
    public static String objectArrayToString(Object[] arr, String name) {
        if (arr == null) {
            return "null";
        }

        StringBuffer sb = new StringBuffer();
        int len = arr.length;
        for (int i = 0; i < len; i++) {
            sb.append("\n    " + name + "[" + i + "]:\n");
            sb.append("    " + arr[i].toString());
        }
        return sb.toString();
    }
}

Related

  1. convertObjectToString(Object obj)
  2. convertObjectToString(Object object)
  3. convertObjectToString(Object value)
  4. objectArrayToString(Object object)
  5. objectArrayToString(Object[] arr)
  6. objectArrayToString(Object[] objArray, String separator)
  7. objectArrayToString(Object[] objectArray)
  8. objectArrayToString(Object[] objects)
  9. objectArrayToString(String separator, Object... objects)