Java Double Array Create doubleArray(int... in)

Here you can find the source of doubleArray(int... in)

Description

double Array

License

Open Source License

Declaration

public static String doubleArray(int... in) 

Method Source Code

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

public class Main {
    public static String doubleArray(int... in) {
        String out = "[ ";
        for (int d : in) {
            out += (d + " , ");
        }/* w ww . ja  va2s  .c o  m*/
        //Magic number 2 stems from the wish to remove the ", " from the end of the string.
        //If the for-loop was never entered however, out.lenght == 2. In that case, we do nothing 
        out = out.substring(0, out.length() - 2 > 0 ? out.length() - 2 : 2);
        return out + "]";
    }
}

Related

  1. doubleArray(Double... elements)
  2. doubleArray(String data)
  3. doubleArray2Json(double[] array)
  4. doubleArrayFromString(final String data)
  5. doubleArrayFromString(String record)