Java String Array Merge mergeInts(int[] values, String delimiter)

Here you can find the source of mergeInts(int[] values, String delimiter)

Description

merge Ints

License

Open Source License

Declaration

static public String mergeInts(int[] values, String delimiter) 

Method Source Code

//package com.java2s;
/*/*from w  w w.  ja  v  a 2 s . co  m*/
 * Copyright 2000-2013 Enonic AS
 * http://www.enonic.com/license
 */

public class Main {
    static public String mergeInts(int[] values, String delimiter) {
        if (values == null || values.length == 0) {
            return null;
        }

        StringBuffer merged = new StringBuffer(String.valueOf(values[0]));
        for (int i = 1; i < values.length; i++) {
            merged.append(delimiter);
            merged.append(values[i]);
        }
        return merged.toString();
    }
}

Related

  1. merge(String[] mainSelector, String[] base)
  2. merge(String[] pieces, String sep)
  3. merge(String[] src, String delimiter)
  4. merge(String[] str, String sep)
  5. merge(T[] arr0, String delimiter)
  6. mergeJoin(String sep, String[] a1, String[] a2)
  7. mergeJoin(String sep, String[] a1, String[] a2)
  8. mergeString(String currentValue, String newValue)
  9. mergeString(String[] str1, String[] str2)