Issue with using array after splitTokens()

example for above wording:

import processing.serial.*;
Serial port;
String ports, inString;
String[] elements;
boolean diagp = true;
int baud = 115200; // 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200, 230400, 250000, 500000, 1000000, 2000000
boolean getrecord= false;
int many = 0, expect = 7, recs=0;
int[] values = new int[expect];
float zoom;

public void setup() {
  size(300, 300);
  if ( diagp ) printArray(Serial.list());
  ports = Serial.list()[1];
  port = new Serial(this, ports, baud);
  port.bufferUntil('\n');
  stroke(0);
  zoom = height/1023.0;
  background(200, 200, 0);
}

void draw() {
  if ( getrecord ) {
    getdata();
    stroke(200,200,0);
    line(recs, 0, recs, height);
    for (int i=0; i<expect; i++ ) { 
      float ypos = height - values[i]*zoom;
      if ( i > 4 ) ypos = height-40*(i-4) - 10*values[i]; // for the digital vals
      if ( diagp ) println(" values ["+i+"] "+values[i]+" xpos "+recs+" ypos "+ypos);
      stroke(0, i*40, 200-i*40);
      point( recs, ypos );
    }
    recs++;
    if ( recs > width ) recs = 0;
    stroke(255);
    line(recs, 0, recs, height);
    getrecord = false;
  }
}


void getdata() {
  if ( diagp ) println(inString);
  elements = splitTokens(inString, ",");  // split and set some globals...
  int many = elements.length;
  if ( many >= expect ) {
    for (int i=0; i<expect; i++ ) { 
      if ( diagp ) print(elements[i]+" , ");
      values[i] = int(elements[i]);
    }
    if ( diagp ) println();
  } else {
    println("com error, found short line:"+inString);
  }
}

void serialEvent(Serial thisport) {                     // read the serial buffer:
  inString = thisport.readString();
  if ( inString  != null ) {
    inString = trim(inString);                          // clean
    getrecord = true;
  }
}


/*
// arduino code tested Arduino Leonardo Arduino IDE 1.8.9 hourly 
 
 String aline; // readable char line
 
 void make_aline() {
 aline = "";
 aline += analogRead(0);
 aline += ',';
 aline += analogRead(1);
 aline += ',';
 aline += analogRead(2);
 aline += ',';
 aline += analogRead(3);
 aline += ',';
 aline += analogRead(4);
 aline += ',';
 aline += digitalRead(2);
 aline += ',';
 aline += digitalRead(3);
 // ++ CR LF
 }
 
 int wait = 500;
 long baud = 115200; // 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200, 230400, 250000, 500000, 1000000, 2000000
 
 void setup() {
 Serial.begin(baud);
 while (!Serial) {
 ;  // wait for serial port to connect. Needed for native USB port only ( arduino leonardo )
 }
 }
 
 void loop() {
 make_aline();
 Serial.println(aline);
 delay(wait);
 }
 
 */