added some java and scala code