Android examples for File Input Output:Json String
long Array to Json String
//package com.java2s; public class Main { static String longArray2Json(final long[] array) { if (array.length == 0) { return "[]"; }/*from w ww.j ava 2 s . c om*/ final StringBuilder sb = new StringBuilder(array.length << 4); sb.append('['); for (final long o : array) { sb.append(Long.toString(o)); sb.append(','); } // set last ',' to ']': sb.setCharAt(sb.length() - 1, ']'); return sb.toString(); } }