serial communication between arduino and processing

void loop(){
  readTouchInputs();
 }

I guess I'll never understand why a function does nothing but call another function.

            if(i==0)
            {

             Serial.print((char)0);
             
            }
            
             
            if(i==1)
            {

              Serial.print((char)0);
            }

A reasonable amount of white space is one thing. This amount of white space is something else.

Putting each { on a new line and using Tools + Auto Format and deleting all the useless white space would make your code a lot easier to read. But, basically, it looks like your Arduino sketch is sending '0', '1', or '2' to the serial port when a key is pressed or released.

Then. your Processing sketch is looking for 0, 1, or 2. 0 != '0'. 1 != '1'. 2 != '2'.

Of course, all that you said was what you wanted. You said nothing about what the code actually does, or what problems you are having.