Spending a minute reading the reference pages for Serial.available() and Serial.read() would benefit you greatly.