Java Float Array Convert floatArray2Json(float[] array)

Here you can find the source of floatArray2Json(float[] array)

Description

float Array Json

License

Apache License

Declaration

static String floatArray2Json(float[] array) 

Method Source Code

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

public class Main {
    static String floatArray2Json(float[] array) {
        if (array.length == 0)
            return "[]";
        StringBuilder sb = new StringBuilder(array.length << 4);
        sb.append('[');
        for (float o : array) {
            sb.append(Float.toString(o));
            sb.append(',');
        }//  w ww . ja va2s . com
        // set last ',' to ']':
        sb.setCharAt(sb.length() - 1, ']');
        return sb.toString();
    }
}

Related

  1. floatArrayPlusFloat(float[] xs, float y)
  2. floatArrayToDouble(float[] from)