Since you use xDimen / 2 a lot, why not make it a double variable by itself?  double halfX?