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

# ECFieldF2m


`
public


class
ECFieldF2m
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


implements

https://developer.android.com/reference/java/security/spec/ECField


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | java.security.spec.ECFieldF2m |

<br />

*** ** * ** ***

This immutable class defines an elliptic curve (EC)
characteristic 2 finite field.
**See also:**

- `https://developer.android.com/reference/java/security/spec/ECField`

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/java/security/spec/ECFieldF2m#ECFieldF2m(int)(int m) ` Creates an elliptic curve characteristic 2 finite field which has 2\^`m` elements with normal basis. |
| ` https://developer.android.com/reference/java/security/spec/ECFieldF2m#ECFieldF2m(int,%20int[])(int m, int[] ks) ` Creates an elliptic curve characteristic 2 finite field which has 2\^`m` elements with polynomial basis. |
| ` https://developer.android.com/reference/java/security/spec/ECFieldF2m#ECFieldF2m(int,%20java.math.BigInteger)(int m, https://developer.android.com/reference/java/math/BigInteger rp) ` Creates an elliptic curve characteristic 2 finite field which has 2\^`m` elements with polynomial basis. |

| ### Public methods ||
|---|---|
| ` boolean` | ` https://developer.android.com/reference/java/security/spec/ECFieldF2m#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Compares this finite field for equality with the specified object. |
| ` int` | ` https://developer.android.com/reference/java/security/spec/ECFieldF2m#getFieldSize()() ` Returns the field size in bits which is `m` for this characteristic 2 finite field. |
| ` int` | ` https://developer.android.com/reference/java/security/spec/ECFieldF2m#getM()() ` Returns the value `m` of this characteristic 2 finite field. |
| ` int[]` | ` https://developer.android.com/reference/java/security/spec/ECFieldF2m#getMidTermsOfReductionPolynomial()() ` Returns an integer array which contains the order of the middle term(s) of the reduction polynomial for polynomial basis or null for normal basis. |
| ` https://developer.android.com/reference/java/math/BigInteger` | ` https://developer.android.com/reference/java/security/spec/ECFieldF2m#getReductionPolynomial()() ` Returns a BigInteger whose i-th bit corresponds to the i-th coefficient of the reduction polynomial for polynomial basis or null for normal basis. |
| ` int` | ` https://developer.android.com/reference/java/security/spec/ECFieldF2m#hashCode()() ` Returns a hash code value for this characteristic 2 finite field. |

| ### 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/security/spec/ECField ` |---|---| | ` abstract int` | ` https://developer.android.com/reference/java/security/spec/ECField#getFieldSize()() ` Returns the field size in bits. | ||

## Public constructors

### ECFieldF2m

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

```
public ECFieldF2m (int m)
```

Creates an elliptic curve characteristic 2 finite
field which has 2\^`m` elements with normal basis.

<br />

| Parameters ||
|---|---|
| `m` | `int`: with 2\^`m` being the number of elements. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if `m` is not positive. |

### ECFieldF2m

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

```
public ECFieldF2m (int m, 
                int[] ks)
```

Creates an elliptic curve characteristic 2 finite
field which has 2\^`m` elements with
polynomial basis. The reduction polynomial for this
field is based on `ks` whose content
contains the order of the middle term(s) of the
reduction polynomial.
Note: A valid reduction polynomial is either a
trinomial (X\^`m` + X\^`k` + 1
with `m` \> `k` \>= 1) or a
pentanomial (X\^`m` + X\^`k3`
+ X\^`k2` + X\^`k1` + 1 with
`m` \> `k3` \> `k2`
\> `k1` \>= 1), so `ks` should
have length 1 or 3.

<br />

| Parameters ||
|---|---|
| `m` | `int`: with 2\^`m` being the number of elements. <br /> |
| `ks` | `int`: the order of the middle term(s) of the reduction polynomial. Contents of this array are copied to protect against subsequent modification. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if`m` is not positive, or the length of `ks` is neither 1 nor 3, or values in `ks` are not between `m`-1 and 1 (inclusive) and in descending order. |
| `https://developer.android.com/reference/java/lang/NullPointerException` | if `ks` is null. |

### ECFieldF2m

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

```
public ECFieldF2m (int m, 
                BigInteger rp)
```

Creates an elliptic curve characteristic 2 finite
field which has 2\^`m` elements with
polynomial basis.
The reduction polynomial for this field is based
on `rp` whose i-th bit corresponds to
the i-th coefficient of the reduction polynomial.


Note: A valid reduction polynomial is either a
trinomial (X\^`m` + X\^`k` + 1
with `m` \> `k` \>= 1) or a
pentanomial (X\^`m` + X\^`k3`
+ X\^`k2` + X\^`k1` + 1 with
`m` \> `k3` \> `k2`
\> `k1` \>= 1).

<br />

| Parameters ||
|---|---|
| `m` | `int`: with 2\^`m` being the number of elements. <br /> |
| `rp` | `BigInteger`: the BigInteger whose i-th bit corresponds to the i-th coefficient of the reduction polynomial. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if `m` is not positive, or `rp` does not represent a valid reduction polynomial. |
| `https://developer.android.com/reference/java/lang/NullPointerException` | if `rp` is null. |

## Public methods

### equals

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

```
public boolean equals (Object obj)
```

Compares this finite field for equality with the
specified object.

<br />

| Parameters ||
|---|---|
| `obj` | `Object`: the object to be compared. <br /> |

| Returns ||
|---|---|
| `boolean` | true if `obj` is an instance of ECFieldF2m and both `m` and the reduction polynomial match, false otherwise. <br /> |

### getFieldSize

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

```
public int getFieldSize ()
```

Returns the field size in bits which is `m`
for this characteristic 2 finite field.

<br />

| Returns ||
|---|---|
| `int` | the field size in bits. <br /> |

### getM

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

```
public int getM ()
```

Returns the value `m` of this characteristic
2 finite field.

<br />

| Returns ||
|---|---|
| `int` | `m` with 2\^`m` being the number of elements. <br /> |

### getMidTermsOfReductionPolynomial

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

```
public int[] getMidTermsOfReductionPolynomial ()
```

Returns an integer array which contains the order of the
middle term(s) of the reduction polynomial for polynomial
basis or null for normal basis.

<br />

| Returns ||
|---|---|
| `int[]` | an integer array which contains the order of the middle term(s) of the reduction polynomial for polynomial basis or null for normal basis. A new array is returned each time this method is called. <br /> |

### getReductionPolynomial

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

```
public BigInteger getReductionPolynomial ()
```

Returns a BigInteger whose i-th bit corresponds to the
i-th coefficient of the reduction polynomial for polynomial
basis or null for normal basis.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/math/BigInteger` | a BigInteger whose i-th bit corresponds to the i-th coefficient of the reduction polynomial for polynomial basis or null for normal basis. <br /> |

### hashCode

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

```
public int hashCode ()
```

Returns a hash code value for this characteristic 2
finite field.

<br />

| Returns ||
|---|---|
| `int` | a hash code value. <br /> |