Java Integer Array Convert To intArray2Json(int[] array)

Here you can find the source of intArray2Json(int[] array)

Description

int Array Json

License

Apache License

Declaration

static String intArray2Json(int[] array) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    static String intArray2Json(int[] array) {
        if (array.length == 0)
            return "[]";
        StringBuilder sb = new StringBuilder(array.length << 4);
        sb.append('[');
        for (int o : array) {
            sb.append(Integer.toString(o));
            sb.append(',');
        }/*from w ww .  j  ava 2  s.c  o m*/
        // set last ',' to ']':
        sb.setCharAt(sb.length() - 1, ']');
        return sb.toString();
    }
}

Related

  1. copySignedIntToDoubleArray(int[] src)
  2. copySignedIntToShortArray(int[] src)
  3. intArray2HashCode(int[] xs)
  4. intArray2HexString(int[] intArray)
  5. intArray2IntegerArray(int[] array, int newLength)
  6. intArrayToAddressString(int vals[])
  7. intArrayToBits(int[] ina, int min, int max, int numBits)
  8. intArrayToCharArray(int[][] intArray)
  9. intArrayToFloatArray(int[] intArray)