Google is committed to advancing racial equity for Black communities. See how.

CircularByteArray

public class CircularByteArray
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.CircularByteArray


Data structure for holding a fixed size array that operates as a circular buffer, and tracks the total sum of all values in the array.

Summary

Public constructors

CircularByteArray(int size)

Public methods

void add(byte value)

Adds a new value to array, replacing oldest value if necessary

long getSum()

Gets the total value of all elements currently stored in array

int size()

Get the number of elements stored

Public constructors

CircularByteArray

public CircularByteArray (int size)

Parameters
size int

Public methods

add

public void add (byte value)

Adds a new value to array, replacing oldest value if necessary

getSum

public long getSum ()

Gets the total value of all elements currently stored in array

Returns
long

size

public int size ()

Get the number of elements stored

Returns
int