BitSet.PreviousSetBit(Int32) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
回傳設定為 且 true 出現在指定起始索引之前的最近位元索引。
[Android.Runtime.Register("previousSetBit", "(I)I", "GetPreviousSetBit_IHandler")]
public virtual int PreviousSetBit(int fromIndex);
[<Android.Runtime.Register("previousSetBit", "(I)I", "GetPreviousSetBit_IHandler")>]
abstract member PreviousSetBit : int -> int
override this.PreviousSetBit : int -> int
參數
- fromIndex
- Int32
開始查詢的索引(含)
傳回
前一組位元的索引,或 -1 若不存在該位元則是
- 屬性
例外狀況
如果 index 。
備註
回傳設定為 且 true 出現在指定起始索引之前的最近位元索引。 若不存在此類位元,或若 -1 為起始索引,則 -1 回傳。
要遍 true 歷 中的 BitSet位元,請使用以下迴圈:
{@code
for (int i = bs.length(); (i = bs.previousSetBit(i-1)) >= 0; ) {
// operate on index i here
}}
在 1.7 版本中加入。
Java 文件 java.util.BitSet.previousSetBit(.*int)。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。