Help with arduino + processing interfacing...

Im having issues with interfacing the arduino serial and processing

My arduino code is:

int switchPin = 4;                       // Switch connected to pin 4

void setup() {
  pinMode(switchPin, INPUT);     
  digitalWrite(switchPin, HIGH);
  Serial.begin(9600);                    // Start serial communication at 9600 bps
}

void loop() {
  if (digitalRead(switchPin) == LOW) {  // If switch is ON,
    Serial.print(1);               // send 1 to Processing
  } else {                               // If the switch is not ON,
    Serial.print(0);               // send 0 to Processing
  }
  delay(100);                            // Wait 100 milliseconds
}

and my processing code is:

/**
 * Simple Read
 * 
 * Read data from the serial port and change the color of a rectangle
 * when a switch connected to a Wiring or Arduino board is pressed and released.
 * This example works with the Wiring / Arduino program that follows below.
 */


import processing.serial.*;

Serial myPort;  // Create object from Serial class
int val;      // Data received from the serial port

void setup() 
{
  size(200, 200);
  // I know that the first port in the serial list on my mac
  // is always my  FTDI adaptor, so I open Serial.list()[0].
  // On Windows machines, this generally opens COM1.
  // Open whatever port is the one you're using.
  String portName = Serial.list()[0];
  myPort = new Serial(this, portName, 9600);
}

void draw()
{
  if ( myPort.available() > 0) {  // If data is available,
    val = myPort.read();         // read it and store it in val
  }
  background(255);             // Set background to white
  if (val == 0) {              // If the serial value is 0,
    fill(0);                   // set fill to black
  } 
  else {                       // If the serial value is not 0,
    fill(204);                 // set fill to light gray
  }
  rect(50, 50, 100, 100);
}

I have a button wired to pin 4 and GND… if I read the arduino serial port it prints 1’s and 0’s like I want… but running the processing code doesnt give me any results (i exited the serial monitor in arduino IDE tho). Anyone have any ideas? I am a little stuck and would like to figure out how to interface processing and arduino ASAP

Your Arduino code is sending the ASCII values of 0 and 1 (48 and 49). You can fix it by doing either one (but not both) of the following changes:

if (digitalRead(switchPin) == LOW) { // If switch is ON,
Serial.print(1,BYTE); // send 1 to Processing
}
else { // If the switch is not ON,
Serial.print(0,BYTE); // send 0 to Processing
}

Or in Processing:
if (val == ‘0’) { // If the serial value is the character 0,