Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/java/util/zip/CRC32#pubctors) \| [Methods](https://developer.android.com/reference/java/util/zip/CRC32#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/java/util/zip/CRC32#inhmethods)

# CRC32

` public class CRC32 `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/java/util/zip/Checksum `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | java.util.zip.CRC32 |

<br />

*** ** * ** ***

A class that can be used to compute the CRC-32 of a data stream.

Passing a `null` argument to a method in this class will cause a `https://developer.android.com/reference/java/lang/NullPointerException` to be thrown.

<br />

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/java/util/zip/CRC32#CRC32()() ` Creates a new CRC32 object. |

| ### Public methods ||
|---|---|
| ` long` | ` https://developer.android.com/reference/java/util/zip/CRC32#getValue()() ` Returns CRC-32 value. |
| ` void` | ` https://developer.android.com/reference/java/util/zip/CRC32#reset()() ` Resets CRC-32 to initial value. |
| ` void` | ` https://developer.android.com/reference/java/util/zip/CRC32#update(byte[])(byte[] b) ` Updates the CRC-32 checksum with the specified array of bytes. |
| ` void` | ` https://developer.android.com/reference/java/util/zip/CRC32#update(java.nio.ByteBuffer)(https://developer.android.com/reference/java/nio/ByteBuffer buffer) ` Updates the CRC-32 checksum with the bytes from the specified buffer. |
| ` void` | ` https://developer.android.com/reference/java/util/zip/CRC32#update(byte[],%20int,%20int)(byte[] b, int off, int len) ` Updates the CRC-32 checksum with the specified array of bytes. |
| ` void` | ` https://developer.android.com/reference/java/util/zip/CRC32#update(int)(int b) ` Updates the CRC-32 checksum with the specified byte (the low eight bits of the argument b). |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.
From interface ` https://developer.android.com/reference/java/util/zip/Checksum ` ` abstract long` ` https://developer.android.com/reference/java/util/zip/Checksum#getValue()() `

Returns the current checksum value.
` abstract void` ` https://developer.android.com/reference/java/util/zip/Checksum#reset()() `

Resets the checksum to its initial value.
` default void` ` https://developer.android.com/reference/java/util/zip/Checksum#update(byte[])(byte[] b) `

Updates the current checksum with the specified array of bytes.
` default void` ` https://developer.android.com/reference/java/util/zip/Checksum#update(java.nio.ByteBuffer)(https://developer.android.com/reference/java/nio/ByteBuffer buffer) `

Updates the current checksum with the bytes from the specified buffer.
` abstract void` ` https://developer.android.com/reference/java/util/zip/Checksum#update(byte[],%20int,%20int)(byte[] b, int off, int len) `

Updates the current checksum with the specified array of bytes.
` abstract void` ` https://developer.android.com/reference/java/util/zip/Checksum#update(int)(int b) `

Updates the current checksum with the specified byte.

## Public constructors

### CRC32

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CRC32 ()
```

Creates a new CRC32 object.

<br />

## Public methods

### getValue

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public long getValue ()
```

Returns CRC-32 value.

<br />

| Returns ||
|---|---|
| `long` | the current checksum value <br /> |

### reset

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void reset ()
```

Resets CRC-32 to initial value.

<br />

### update

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void update (byte[] b)
```

Updates the CRC-32 checksum with the specified array of bytes.

<br />

| Parameters ||
|---|---|
| `b` | `byte`: the array of bytes to update the checksum with <br /> |

### update

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void update (ByteBuffer buffer)
```

Updates the CRC-32 checksum with the bytes from the specified buffer. The checksum is updated with the remaining bytes in the buffer, starting at the buffer's position. Upon return, the buffer's position will be updated to its limit; its limit will not have been changed.

<br />

| Parameters ||
|---|---|
| `buffer` | `ByteBuffer`: the ByteBuffer to update the checksum with <br /> |

### update

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void update (byte[] b, 
                int off, 
                int len)
```

Updates the CRC-32 checksum with the specified array of bytes.

<br />

| Parameters ||
|---|---|
| `b` | `byte`: the byte array to update the checksum with <br /> |
| `off` | `int`: the start offset of the data <br /> |
| `len` | `int`: the number of bytes to use for the update <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException` | if `off` is negative, or `len` is negative, or `off+len` is negative or greater than the length of the array `b`. |

### update

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void update (int b)
```

Updates the CRC-32 checksum with the specified byte (the low eight bits of the argument b).

<br />

| Parameters ||
|---|---|
| `b` | `int`: the byte to update the checksum with <br /> |