Update Velocity.java

This is an attempt to make this code more efficient and keep its accuracy.