Java Array to String array2String(long[] array)

Here you can find the source of array2String(long[] array)

Description

array String

License

LGPL

Declaration

public static String array2String(long[] array) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.util.*;

public class Main {
    public static String array2String(long[] array) {
        StringBuilder ret = new StringBuilder("[");

        if (array != null) {
            for (int i = 0; i < array.length; i++)
                ret.append(array[i]).append(" ");
        }//from   w  ww .  jav  a2  s . c o m

        ret.append(']');
        return ret.toString();
    }

    public static String array2String(short[] array) {
        StringBuilder ret = new StringBuilder("[");

        if (array != null) {
            for (int i = 0; i < array.length; i++)
                ret.append(array[i]).append(" ");
        }

        ret.append(']');
        return ret.toString();
    }

    public static String array2String(int[] array) {
        StringBuilder ret = new StringBuilder("[");

        if (array != null) {
            for (int i = 0; i < array.length; i++)
                ret.append(array[i]).append(" ");
        }

        ret.append(']');
        return ret.toString();
    }

    public static String array2String(boolean[] array) {
        StringBuilder ret = new StringBuilder("[");

        if (array != null) {
            for (int i = 0; i < array.length; i++)
                ret.append(array[i]).append(" ");
        }
        ret.append(']');
        return ret.toString();
    }

    public static String array2String(Object[] array) {
        return Arrays.toString(array);
    }
}

Related

  1. array2String(E[] array)
  2. array2string(final T[] array, final int top)
  3. array2string(int[] _a)
  4. array2String(int[] paramArrayOfInt)
  5. array2String(long[] array)
  6. array2String(Object[] a, int size)
  7. array2string(Object[] array)
  8. array2String(Object[] objs)
  9. array2String(String[] array)