java - How do I put a String into an array and then into an array of double? -



java - How do I put a String into an array and then into an array of double? -

currently have this:

public class sequence { private double[] sequence; // set sequence parsing s //the numbers in s seperated commas public sequence(string s) { string [] terms = s.split (","); sequence = double.parsedouble(terms); } }

what have not work. trying accomplish move numerical terms in string s (such 1,2,3,4,5,6) in array of double called sequence.

double.parsedouble take 1 string , returns 1 double. passing array of strings. alter code pass 1 string.

public sequence(string s) { string [] terms = s.split (","); sequence = new double[terms.length]; (int = 0; < terms.length; i++) { sequence[i] = double.parsedouble(terms[i]); } }

java arrays double sequences

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -