Java Array Concatenate concatArray(int[] src, String separator)

Here you can find the source of concatArray(int[] src, String separator)

Description

concat Array

License

Open Source License

Declaration

public static String concatArray(int[] src, String separator) 

Method Source Code

//package com.java2s;

public class Main {

    public static String concatArray(int[] src, String separator) {

        if (src.length == 0) {
            return null;
        }/*from  w  w  w  . j  a v a2  s  .  co  m*/

        if (src.length <= 1) {
            return String.valueOf(src[0]);
        }

        StringBuilder builder = new StringBuilder();

        builder.append(src[0]);

        for (int i = 1; i < src.length; i++) {
            builder.append(separator).append(src[i]);
        }

        return builder.toString();
    }
}

Related

  1. concatAll(T[] first, T[]... rest)
  2. concatAll(T[] first, T[]... rest)
  3. concatAllArrays(byte[] data1, byte[]... remaining)
  4. concatArray(byte data1[], byte data2[])
  5. concatArray(byte[] old1, byte[] old2)
  6. concatArray(Object... objects)
  7. concatArray(Object[] arr1, Object newValue)
  8. concatArray(String string, String[] words)
  9. concatArray(String[] array, int start)