public class ProgressionUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static int |
getProgressionFinalElement(int start,
int end,
int increment)
Calculates the final element of a bounded arithmetic progression, i.e.
|
static long |
getProgressionFinalElement(long start,
long end,
long increment)
Calculates the final element of a bounded arithmetic progression, i.e.
|
public static int getProgressionFinalElement(int start,
int end,
int increment)
start to end in case of a positive increment, or from end to start in case of a negative
increment.
No validation on passed parameters is performed. The given parameters should satisfy the condition: either
increment > 0 and start <= end, or increment < 0 and start >= end.
start - first element of the progressionend - ending bound for the progressionincrement - increment, or difference of successive elements in the progressionpublic static long getProgressionFinalElement(long start,
long end,
long increment)
start to end in case of a positive increment, or from end to start in case of a negative
increment.
No validation on passed parameters is performed. The given parameters should satisfy the condition: either
increment > 0 and start <= end, or increment < 0 and start >= end.
start - first element of the progressionend - ending bound for the progressionincrement - increment, or difference of successive elements in the progressionCopyright © 2013. All Rights Reserved.