7
public RLEIterator(int[] encoding) {8
int encodeLen = encoding.length;9
this.prefixEncoded = new long[encodeLen];10
for (int i = 0; i < encodeLen; i += 2) {11
long prevPrefixSum = 0;13
prevPrefixSum = this.prefixEncoded[i - 2];15
this.prefixEncoded[i] = encoding[i] + prevPrefixSum;16
this.prefixEncoded[i + 1] = encoding[i + 1];20
public int next(int n) {21
int r = this.prefixEncoded.length - 2;25
if (l >= this.prefixEncoded.length26
|| processed > this.prefixEncoded[this.prefixEncoded.length - 2]) {31
int m = (l + ((r - l) / 2));35
if (this.prefixEncoded[m] >= processed) {41
return l >= this.prefixEncoded.length ? -1 : (int) this.prefixEncoded[l + 1];