# Size

Artifact: [androidx.annotation:annotation](https://developer.android.com/jetpack/androidx/releases/annotation) [View Source](https://cs.android.com/search?q=file:androidx/annotation/Size.kt+class:androidx.annotation.Size) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/annotation#1.0.0)

*** ** * ** ***


```
@MustBeDocumented
@Retention(value = AnnotationRetention.BINARY)
@Target(allowedTargets = [AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.FIELD, AnnotationTarget.ANNOTATION_CLASS])
public annotation Size
```

<br />

*** ** * ** ***

Denotes that the annotated element should have a given size or length. Note that "-1" means "unset". Typically used with a parameter or return value of type array or collection.

Example:

```
public void getLocationInWindow(@Size(2) int[] location) {
    ...
}
```

## Summary

| ### Public methods |
|---|---|
| `final long` | `https://developer.android.com/reference/androidx/annotation/Size#getMax()()` A maximum size, inclusive |
| `final long` | `https://developer.android.com/reference/androidx/annotation/Size#getMin()()` A minimum size, inclusive |
| `final long` | `https://developer.android.com/reference/androidx/annotation/Size#getMultiple()()` The size must be a multiple of this factor |
| `final long` | `https://developer.android.com/reference/androidx/annotation/Size#getValue()()` An exact size (or -1 if not specified) |

## Public methods

### getMax

```
public final long getMax()
```

A maximum size, inclusive

### getMin

```
public final long getMin()
```

A minimum size, inclusive

### getMultiple

```
public final long getMultiple()
```

The size must be a multiple of this factor

### getValue

```
public final long getValue()
```

An exact size (or -1 if not specified)