Why I cannot run code NullPointerException

Normally, my output in Arduino sent some data is “00000000000000000000000000” (example) and When i sent character ’ B ’ to serial port in Arduino it’s will sent “111111111111111111” to serial port

and in my Proxessing in Serial Event(); i use keypress(); to show “1111111111111” data and when it has sent already sent “000000000000” before.