Java Long Number Array Convert longArray2Json(long[] array)

Here you can find the source of longArray2Json(long[] array)

Description

long Array Json

License

Apache License

Declaration

static String longArray2Json(long[] array) 

Method Source Code

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

public class Main {
    static String longArray2Json(long[] array) {
        if (array.length == 0)
            return "[]";
        StringBuilder sb = new StringBuilder(array.length << 4);
        sb.append('[');
        for (long o : array) {
            sb.append(Long.toString(o));
            sb.append(',');
        }// ww  w  .ja v a2  s  .co  m
        // set last ',' to ']':
        sb.setCharAt(sb.length() - 1, ']');
        return sb.toString();
    }
}

Related

  1. longArrayToBytes(long[] d)
  2. longArrayToIntArray(long[] longs)