Java Array to String toString(long[] dom)

Here you can find the source of toString(long[] dom)

Description

to String

License

Apache License

Declaration

public static String[] toString(long[] dom) 

Method Source Code

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

import java.util.Arrays;

public class Main {
    public static String[] toString(long[] dom) {
        String[] result = new String[dom.length];
        for (int i = 0; i < dom.length; i++)
            result[i] = String.valueOf(dom[i]);
        return result;
    }/*from ww  w .j  a va  2s  .  com*/

    public static String[] toString(int[] dom) {
        String[] result = new String[dom.length];
        for (int i = 0; i < dom.length; i++)
            result[i] = String.valueOf(dom[i]);
        return result;
    }

    public static String[] toString(Object[] ary) {
        String[] result = new String[ary.length];
        for (int i = 0; i < ary.length; i++) {
            Object o = ary[i];
            if (o != null && o.getClass().isArray()) {
                Class klazz = ary[i].getClass();
                result[i] = byte[].class.equals(klazz) ? Arrays
                        .toString((byte[]) o)
                        : short[].class.equals(klazz) ? Arrays
                                .toString((short[]) o)
                                : int[].class.equals(klazz) ? Arrays
                                        .toString((int[]) o)
                                        : long[].class.equals(klazz) ? Arrays
                                                .toString((long[]) o)
                                                : boolean[].class
                                                        .equals(klazz) ? Arrays
                                                        .toString((boolean[]) o)
                                                        : float[].class
                                                                .equals(klazz) ? Arrays
                                                                .toString((float[]) o)
                                                                : double[].class
                                                                        .equals(klazz) ? Arrays
                                                                        .toString((double[]) o)
                                                                        : Arrays.toString((Object[]) o);

            } else {
                result[i] = String.valueOf(o);
            }
        }
        return result;
    }
}

Related

  1. toString(final Object[] array)
  2. toString(int X[][])
  3. toString(int[] a, int maxValues)
  4. toString(int[] codes)
  5. toString(int[] v, char delim)
  6. toString(Map arg)
  7. toString(Object array)
  8. toString(Object array)
  9. toString(Object array)