Upgrade java version from 1.6 to 1.7

1. upgrade java version from 1.6 to 1.7
2. use java 1.7 feature to improve code