Java Array to Long arrayToLongString(T[] array)

Here you can find the source of arrayToLongString(T[] array)

Description

array To Long String

License

Open Source License

Declaration

public static <T> String arrayToLongString(T[] array) 

Method Source Code

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

public class Main {
    public static <T> String arrayToLongString(T[] array) {
        StringBuilder sb = new StringBuilder();

        sb.append("[");
        for (int i = 0; i < array.length; i++) {
            sb.append(array[i].toString());
            if (i != array.length - 1)
                sb.append(", ");
        }//from   w  w  w  . j a  va 2 s .c  o  m
        sb.append("]");

        return sb.toString();
    }

    public static String arrayToLongString(int[] array) {
        StringBuilder sb = new StringBuilder();

        sb.append("[");
        for (int i = 0; i < array.length; i++) {
            sb.append(array[i]);
            if (i != array.length - 1)
                sb.append(", ");
        }
        sb.append("]");

        return sb.toString();
    }
}

Related

  1. arrayToLong(final byte[] array, final int start)
  2. arrayToLong(final int[] digits)