change java 7 code into 6