title: Turn string values into 2d array of type double
body: <p>I have a string:</p>
  
  <pre><code>String stringProfile = "0,4.28 10,4.93 20,3.75";
  </code></pre>
  
  <p>I am trying to turn it into an array like as follows:</p>
  
  <pre><code>double [][] values = {{0, 4.28}, {10, 4.93}, {20, 3.75}};
  </code></pre>
  
  <p>I've formatted the string to remove any whitespace and replace with a comma:</p>
  
  <pre><code>String stringProfileFormatted = stringProfile.replaceAll(" ", ",");
  </code></pre>
  
  <p>So now String <code>stringProfileFormatted = "0,4.28,10,4.93,20,3.75";</code></p>
  
  <p>I then create a String array:</p>
  
  <pre><code>String[] array = stringProfileFormatted.split("(?&lt;!\\G\\d+),");
  </code></pre>
  
  <p>So for every element in the Array is every 2 commas worth of string.</p>
  
  <p>Not sure how to then convert into a 2d array. Is this even the right way to go about it?</p>