At 06:01 PM 11/15/99 -0000, Martin Baker wrote:
>Would anyone like to suggest the fastest code to load and array of floating
>point numbers, which does not allocate memory inside the loop, or use
>deprecated classes.

Obviously it helps if you know how many numbers you're going to get so
you don't have to extend your array at run time.  But sometimes you
don't,sigh.

The simplest answer is brute force:

char[] line = new char[TheLongestLineYoullEverGet];
double[] buf = new double[AsManyLinesAsYoureGoingToRead];
int count = 0;

while (efficientlyReadALineIntoCharArray(line))
{
  double n = 0;

  n = // brute-force parse perl regex /-?\d*\.\d*[eE]\d*/

  if (count == buf.length)
    // grow the buffer

  buffer[count++] = n;
}

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to