Java Array to List arrayToList(int[] intArr, int cnt)

Here you can find the source of arrayToList(int[] intArr, int cnt)

Description

array To List

License

Open Source License

Declaration

public static String arrayToList(int[] intArr, int cnt) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {

    public static String arrayToList(int[] intArr, int cnt) {
        return arrayToList(intArr, 0, cnt);
    }/*from  ww  w.j a  va2  s.  com*/

    public static String arrayToList(int[] intArr, int start, int cnt) {
        if (start < 0) {
            start = 0;
        }
        if (cnt < 1) {
            return "";
        }

        int fullCnt = start + cnt;

        fullCnt = (fullCnt < intArr.length) ? fullCnt : intArr.length;
        String strList = "";

        strList = "" + intArr[start];
        for (int i = 1; i < cnt; i++) {
            strList += "," + intArr[start + i];
        }

        return strList;
    }
}

Related

  1. arrayToCommaList(Object[] array)
  2. arrayToCommaList(String[] array)
  3. arrayToList(final T... items)
  4. arrayToList(Object[] objs)
  5. arrayToList(String... stringArray)
  6. arrayToList(String[] array, String delim)
  7. arrayToList(String[] str)