Java tutorial
//package com.java2s; public class Main { public static String shortsToString(short[] data, int offset, int len) { StringBuilder sb = new StringBuilder(); if (len > 0) { int p = offset; sb.append(data[p++]); for (int i = 1; i < len; ++i) { sb.append(',').append(data[p++]); } } return sb.toString(); } }