fixing some static analysis issues. Mostly intellij inspections

…final modifiers. Enhanced for loops. Remove redundant boxing/unboxing. Minor boolean expression simplifications. Junit 4 related updates.