loop reversal works for int and long too