processing reads wrong values from arduino

I was working on a project that arduino sends values of ping sensor to processing. it worked well until I try to extend the wire. Processing starts show crazy number, even though arduino still reads right numbers. so i copy and paste example from website:http://arduino.cc/en/Tutorial/Graph. same problem occurred, which means it is not the code went wrong. but what is possible problem here, please please help!!!
when run arduino:
1023
once open processing:
13
1023
11023
13
1023
23
1023
13
1023
23
1023
023
1023

and it went back to normal 1023 once processing is off.

it worked well until I try to extend the wire.

What exactly do you mean by this?

You can’t have the arduino serial monitor open at the same time as Processing has a connection to the same port.

It does not matter where the code came from. Post the code running on YOUR Arduino and the code running on YOUR PC if you want help.

it worked well until I try to extend the wire.

Until you tried to extend what wire? There are no wires in Processing or Arduino sketches. Maybe you are getting noise now, due to where you have routed the wire you extended.

sorry about the confusion. I was adding longer wire on ping sensor so that I place it somewhere far away from arduino board. I mentioned that because I thought I messed up circuit somewhat.

anyway, it is working now when i closed serial monitor. how stupid I was!

thanks guys!!!