Java Integer Array to String intArrayToString(int[] ia)

Here you can find the source of intArrayToString(int[] ia)

Description

Utility to convert an int[] to a String.

License

Open Source License

Parameter

Parameter Description
ia The int[]

Return

String version

Declaration

public static String intArrayToString(int[] ia) 

Method Source Code

//package com.java2s;
/**********************************************************************
Copyright (c) 2003 Andy Jefferson and others. All rights reserved. 
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/*  w ww  . j  av  a2  s .  c om*/
    
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.
     
    
Contributors:
2003 Erik Bengtson - moved replaceAll from Column class to here
2004 Andy Jefferson - moved intArrayToString, booleanArrayToString from SM
2007 Xuan Baldauf - toJVMIDString hex fix
...
**********************************************************************/

public class Main {
    /**
     * Utility to convert an int[] to a String.
     * @param ia The int[]
     * @return String version
     **/
    public static String intArrayToString(int[] ia) {
        if (ia == null) {
            return "null";
        }

        StringBuilder sb = new StringBuilder("[");
        for (int i = 0; i < ia.length; ++i) {
            if (i > 0) {
                sb.append(", ");
            }

            sb.append(ia[i]);
        }
        sb.append(']');

        return sb.toString();
    }
}

Related

  1. intArrayToString(int[] a)
  2. intArrayToString(int[] a, String separator)
  3. intArrayToString(int[] arr)
  4. intArrayToString(int[] array)
  5. intArrayToString(int[] array, boolean whiteSpaceSeperator)
  6. intArrayToString(int[] iarray, int count)
  7. intArrayToString(int[] intArray)
  8. intArrayToString(int[] intArray, String conv)
  9. intArrayToString(int[] ints)