public class **LabelUtil** Label operation utils.

### Public Methods

|---|---|
| static [List](https://developer.android.com/reference/java/util/List.html)\<[String](https://developer.android.com/reference/java/lang/String.html)\> | [mapValueToLabels](https://developers.google.com/edge/api/tflite/java/org/tensorflow/lite/support/label/LabelUtil#mapValueToLabels(org.tensorflow.lite.support.tensorbuffer.TensorBuffer,%20java.util.List<java.lang.String>,%20int))([TensorBuffer](https://developers.google.com/edge/api/tflite/java/org/tensorflow/lite/support/tensorbuffer/TensorBuffer) tensorBuffer, [List](https://developer.android.com/reference/java/util/List.html)\<[String](https://developer.android.com/reference/java/lang/String.html)\> labels, int offset) Maps an int value tensor to a list of string labels. |

### Inherited Methods

From class java.lang.Object

|---|---|
| boolean | equals([Object](https://developer.android.com/reference/java/lang/Object.html) arg0) |
| final [Class](https://developer.android.com/reference/java/lang/Class.html)\<?\> | getClass() |
| int | hashCode() |
| final void | notify() |
| final void | notifyAll() |
| [String](https://developer.android.com/reference/java/lang/String.html) | toString() |
| final void | wait(long arg0, int arg1) |
| final void | wait(long arg0) |
| final void | wait() |

## Public Methods

#### public static [List](https://developer.android.com/reference/java/util/List.html)\<[String](https://developer.android.com/reference/java/lang/String.html)\>
**mapValueToLabels**
([TensorBuffer](https://developers.google.com/edge/api/tflite/java/org/tensorflow/lite/support/tensorbuffer/TensorBuffer) tensorBuffer, [List](https://developer.android.com/reference/java/util/List.html)\<[String](https://developer.android.com/reference/java/lang/String.html)\> labels, int offset)

Maps an int value tensor to a list of string labels. It takes an array of strings as the
dictionary. Example: if the given tensor is \[3, 1, 0\], and given labels is \["background",
"apple", "banana", "cherry", "date"\], the result will be \["date", "banana", "apple"\].

##### Parameters

| tensorBuffer | A tensor with index values. The values should be non-negative integers, and each value `x` will be converted to `labels[x + offset]`. If the tensor is given as a float `https://developers.google.com/edge/api/tflite/java/org/tensorflow/lite/support/tensorbuffer/TensorBuffer`, values will be cast to integers. All values that are out of bound will map to empty string. |
| labels | A list of strings, used as a dictionary to look up. The index of the array element will be used as the key. To get better performance, use an object that implements RandomAccess, such as `https://developer.android.com/reference/java/util/ArrayList.html`. |
| offset | The offset value when look up int values in the `labels`. |
|---|---|

##### Returns

- the mapped strings. The length of the list is `https://developers.google.com/edge/api/tflite/java/org/tensorflow/lite/support/tensorbuffer/TensorBuffer#getFlatSize()`.

##### Throws

| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException.html) | if `tensorBuffer` or `labels` is null. |
|---|---|