Java: moderate mth to last element