Write toJava methods