Java Array to String arrayToString(double... a)

Here you can find the source of arrayToString(double... a)

Description

array To String

License

LGPL

Declaration

public static String arrayToString(double... a) 

Method Source Code

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

public class Main {
    public static String arrayToString(double... a) {
        StringBuffer result = new StringBuffer();
        if (a.length > 0) {
            result.append(a[0]);/*from  www  .j  a  v a 2s  .c om*/
            for (int i = 1; i < a.length; i++) {
                result.append(",");
                result.append(a[i]);
            }
        }
        return "[" + result.toString() + "]";
    }

    public static String arrayToString(int... a) {
        StringBuffer result = new StringBuffer();
        if (a.length > 0) {
            result.append(a[0]);
            for (int i = 1; i < a.length; i++) {
                result.append(",");
                result.append(a[i]);
            }
        }
        return "[" + result.toString() + "]";
    }

    public static String arrayToString(Object... a) {
        StringBuffer result = new StringBuffer();
        if (a.length > 0) {
            result.append(a[0]);
            for (int i = 1; i < a.length; i++) {
                result.append(",");
                result.append(a[i]);
            }
        }
        return "[" + result.toString() + "]";
    }
}

Related

  1. arrayToString(byte[] arg)
  2. arrayToString(byte[] array)
  3. arrayToString(byte[] bytes)
  4. arrayToString(byte[] source, int index, short size)
  5. arrayToString(double d[])
  6. arrayToString(double[] array)
  7. arrayToString(double[] array, String separator)
  8. arrayToString(double[] v)
  9. arrayToString(double[] xs)