Here you can find the source of toFloats(Float[] values)
public static float[] toFloats(Float[] values)
//package com.java2s; //License from project: Open Source License public class Main { public static final float DEFAULT_FLOAT = 0f; public static float[] toFloats(Float[] values) { return toFloats(values, DEFAULT_FLOAT); }//from w w w . j a v a2 s .c o m public static float[] toFloats(Float[] values, float defaultValue) { float[] results = new float[0]; if (values != null) { results = new float[values.length]; for (int i = 0; i < results.length; i++) { Float element = values[i]; try { results[i] = (element != null ? element.floatValue() : defaultValue); } catch (Exception ex) { // ex.printStackTrace(); } } } return results; } public static Float[] toFloats(float[] values) { return toFloats(values, DEFAULT_FLOAT); } public static Float[] toFloats(float[] values, float defaultValue) { Float[] results = new Float[0]; if (values != null) { results = new Float[values.length]; for (int i = 0; i < results.length; i++) { float element = values[i]; try { results[i] = new Float(element); } catch (Exception ex) { results[i] = defaultValue; // ex.printStackTrace(); } } } return results; } }