Java tutorial
//package com.java2s; public class Main { /** * Turns a string into a float array. * 'spaces' must only contain string equivalent of valid floats separated with commas * with no spaces. * @param string * @return a float array */ public static float[] stringToFloatArray(String string) { String strArray[] = string.split(","); int length = strArray.length; float floatArray[] = new float[length]; int i = 0; for (String str : strArray) { floatArray[i] = Float.parseFloat(str); i++; } return floatArray; } }