refine  the calculation
use java 1.7