Java Integer Array to String intArrayToString(int[] iarray, int count)

Here you can find the source of intArrayToString(int[] iarray, int count)

Description

Put array values in parentheses separated by commas.

License

Open Source License

Declaration

public static String intArrayToString(int[] iarray, int count) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from w w w  .ja  v a 2s. c  o  m
     * Put array values in parentheses separated by commas.
     */
    public static String intArrayToString(int[] iarray, int count) {
        if (count > 0) {
            StringBuilder sb = new StringBuilder("[");
            for (int i = 0; i < count; i++) {
                sb.append(iarray[i]);
                if (i < count - 1)
                    sb.append(", ");
            }
            sb.append("]");
            return sb.toString();
        } else {
            return "[null]";
        }
    }
}

Related

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