Java tutorial
//package com.java2s; //License from project: Apache License public class Main { public static <T> String parseArrayToString(T[] imgsIds) { StringBuilder stringBuilder = new StringBuilder(); for (T t : imgsIds) { stringBuilder.append(t).append(","); } int index = stringBuilder.lastIndexOf(","); if (index == (stringBuilder.toString().length() - 1)) { stringBuilder.deleteCharAt(index); } return stringBuilder.toString(); } }