Java Array to String arrayToString(Object[] arr)

Here you can find the source of arrayToString(Object[] arr)

Description

array To String

License

Open Source License

Declaration

static public String arrayToString(Object[] arr) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2007, 2011 Intel Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:/*from  w ww.j  a v a 2  s.com*/
 * Intel Corporation - Initial API and implementation
 *******************************************************************************/

public class Main {
    static public String arrayToString(Object[] arr) {
        StringBuffer buf = new StringBuffer();
        buf.append('[');
        for (int i = 0; i < arr.length; i++) {
            if (i != 0)
                buf.append(", ");

            buf.append(arr[i].toString());
        }
        buf.append(']');
        return buf.toString();
    }
}

Related

  1. arrayToString(Object[] a)
  2. arrayToString(Object[] anArray, String aPrefix, String aSeparator, String aSuffix, String anEscapeChars, char anEscapeSymbol)
  3. arrayToString(Object[] args, String separator)
  4. arrayToString(Object[] arr)
  5. arrayToString(Object[] arr)
  6. arrayToString(Object[] arr)
  7. arrayToString(Object[] arr, String split)
  8. arrayToString(Object[] array)
  9. arrayToString(Object[] array)