Java Array to String arrayToString(int[] c, String separator)

Here you can find the source of arrayToString(int[] c, String separator)

Description

array To String

License

Open Source License

Declaration

public static String arrayToString(int[] c, String separator) 

Method Source Code

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

public class Main {
    public static String arrayToString(int[] c, String separator) {
        StringBuffer sb = new StringBuffer();

        for (int i = 0; i < c.length; i++) {
            if (i > 0) {
                sb.append(separator);/*from   w  w w .j  a  va  2  s.c o m*/
            }
            sb.append(c[i]);
        }
        return sb.toString();
    }

    public static String arrayToString(double[] c, String separator) {
        StringBuffer sb = new StringBuffer();

        for (int i = 0; i < c.length; i++) {
            if (i > 0) {
                sb.append(separator);
            }
            sb.append(c[i]);
        }
        return sb.toString();
    }
}

Related

  1. arrayToString(int[] array)
  2. arrayToString(int[] array)
  3. arrayToString(int[] array)
  4. arrayToString(int[] array)
  5. arrayToString(int[] ary)
  6. arrayToString(int[] s)
  7. arrayToString(int[] subset)
  8. arrayToString(int[][] array)
  9. arrayToString(Object arbitraryArray)