BigInteger.ToByteArray Method

Converts a BigInteger value to a byte array.

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4
C#
public byte[] ToByteArray()

Return Value

Byte[]
The BigInteger value converted to a byte array.

Remarks

The byte array contains a two's complement representation of the value in little-endian order.

The first (leading) bit of the last byte in the array indicates the sign. A value of 0 indicates that the number is positive. A value of 1 indicates that the number is negative. An extra byte of all 0's (1's) may be added as the last element of the array to make sure that a positive (negative) value is interpreted correctly.

See Also