I'm wondering how I should put my internship experiences in my Statement of Purpose for Master program. The internship experiences (mainly building java web applications) are not quite related to my research interests like distributed systems, real-time computing, etc.
Well It really doesn't matter much whether your research subjects are related to what you have done internships in!
To make it more clear. Internships depicts that you are inclined and willing to work along with your regular curriculum. I would suggest you to relate your internship with research subjects. As we all know that all subjects in Computer Science are inter- related so try to find out any open source concept that you can relate to or willing to work for it. This much is enough. No doubt Research is most important aspect for admissions but you should know to combine it with your life. Give small Instances (backed with Proofs) where you can prove your point. Speaking about Number of years to show for experience is all depends on your profile, show max possible and make sure that you have salary slips.
Any relevant experience is valid subject matter for an application for a program of study.
In your case, your internship experiences are well within the same field of endeavour and I would include them, if space allows.
A researcher who has a particular interest in developing a java web application to interface with a real-time computing solution, might therefore be very interested in your particular skill set.
While I think that any relevant work experience should definitely be included in your resume or cv, I am not sure if its place is in the statement of purpose.
If your internship in some way inspired you to get your master's degree or to pursue a certain area of interest, then I would include it; however, mentioning it for the sake of mentioning it doesn't make sense to me.