Changed from pde to java

Used examples from stackoverflow as a template.
Could not compile with static variables in pde so I had to convert it to java