Share via


BitSet.ToByteArray Method

Definition

Returns a new byte array containing all the bits in this bit set.

[Android.Runtime.Register("toByteArray", "()[B", "GetToByteArrayHandler")]
public virtual byte[]? ToByteArray ();
[<Android.Runtime.Register("toByteArray", "()[B", "GetToByteArrayHandler")>]
abstract member ToByteArray : unit -> byte[]
override this.ToByteArray : unit -> byte[]

Returns

Byte[]

a byte array containing a little-endian representation of all the bits in this bit set

Attributes

Remarks

Returns a new byte array containing all the bits in this bit set.

More precisely, if <br>byte[] bytes = s.toByteArray();<br>then bytes.length == (s.length()+7)/8 and <br>s.get(n) == ((bytes[n/8] & (1<<(n%8))) != 0)<br>for all n < 8 * bytes.length.

Added in 1.7.

Java documentation for java.util.BitSet.toByteArray().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to