Processing and Arduino, drawing rectangles

Your processing code says.... If I have val equal to 1 then if the same val equals 2, 3, or 4 then fill with this color. The problem is that val can only equal one number at a time. Here is a modified code to try. I fixed the code and made a separate color for when val is equal to 1.

import processing.serial.*;

Serial myPort; 
int val;

int[] rects = new int [3];

void setup()
{
  size(600, 200);
  String portName = Serial.list()[0];
  myPort = new Serial(this, "/dev/tty.usbmodem3330431", 9600);

  for (int i=0; i < 3; i++) {
    rects[i] = 0;
  }
}

void draw()
{
  if ( myPort.available() > 0) { 
    val = myPort.read();
  }


  background(255);

  for (int i =0; i < 3; i++) {

    if (val == 1) {
      fill(125, 125, 125);
    }
    
    if (val == 2) {
      fill(255, 0, 0);
    }
    else if (val == 3) {
      fill(0, 255, 0);
    }
    else if (val == 4) {
      fill(0, 0, 255);
    }

    rect(random(50), random(50), 100, 100);
  }
}