日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

c bitset get_Java BitSet get()方法与示例

發布時間:2025/3/11 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 c bitset get_Java BitSet get()方法与示例 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

c bitset get

BitSet類的get()方法 (BitSet Class get() method)

Syntax:

句法:

public boolean get(int bit_in);public BitSet get(int st_in, int en_in);
  • get() method is available in java.util package.

    get()方法在java.util包中可用。

  • get(int bit_in) method is used to return the value of the given bit indices (bit_in). It returns true when the bit with the given index is set by using the set() method.

    get(int bit_in)方法用于返回給定位索引(bit_in)的值。 當使用set()方法設置具有給定索引的位時,它返回true。

  • get(int st_in, int en_in) method is used to returns a subset consisted of bits from this BitSet from the given range st_in(starting index) and en_in(ending index).

    get(int st_in,int en_in)方法用于從給定范圍st_in (起始索引)和en_in (結束索引)返回該BitSet中的位組成的子集。

  • get(int bit_in) method may throw an exception at the time of checking index.

    在檢查索引時, get(int bit_in)方法可能會引發異常。

    IndexOutOfBoundsException: This exception may throw when the given index is less than 0.

    IndexOutOfBoundsException :當給定索引小于0時,可能引發此異常。

  • get(int st_in, int en_in) method may throw an exception at the time of checking exception.

    在檢查異常時, get(int st_in,int en_in)方法可能會引發異常。

    IndexOutOfBoundsException: This exception may throw when st_in or en_in is less than 0 or st_in > en_in.

    IndexOutOfBoundsException :當st_in或en_in小于0或st_in> en_in時,可能引發此異常。

  • These are non-static methods, so it is accessible with the class object and if we try to access these methods with the class name then we will get an error.

    這些是非靜態方法,因此可以通過類對象進行訪問,如果嘗試使用類名稱訪問這些方法,則會收到錯誤消息。

Parameter(s):

參數:

  • In the second case, get(int bit_in)

    在第二種情況下, get(int bit_in)

    • int bit_in – represents the bit index.
    • int bit_in –表示位索引。
  • In the third case, get(int st_in, int en_in)

    在第三種情況下, get(int st_in,int en_in)

    • int st_in – represent the starting bit(st_in) to conclude.
    • int st_in –表示要結束的起始位(st_in)。

Return value:

返回值:

In the first case, boolean get(bit_in): The return type of the method is boolean, it returns true when it returns the value of the bit of the given index.

在第一種情況下, boolean get(bit_in) :方法的返回類型為boolean ,當它返回給定索引的bit值時返回true。

In the second case, BitSet get(int st_in, int en_in), it returns BitSet of the given range (st_in & en_in).

在第二種情況下, BitSet get(int st_in,int en_in) ,它返回給定范圍( st_in&en_in )的BitSet。

Example:

例:

// Java program to demonstrate the example // of get() method of BitSet.import java.util.*;public class GetOfBitSet {public static void main(String[] args) {// create an object of BitSetBitSet bs = new BitSet(10);// By using set() method is to set// the values in BitSet bs.set(10);bs.set(20);bs.set(30);bs.set(40);bs.set(50);bs.set(60);bs.set(70);bs.set(80);// Display BitsetSystem.out.println("bs: " + bs);// By using get(40) method is used to // check the given bit exists in this BitSet or notboolean status = bs.get(40);// Display statusSystem.out.println("bs.get(40): " + status);// By using get(40,60) method is used to // check the given set of bits exists in this// BitSet or not// Display BitsetSystem.out.println("bs.get(40,60): " + bs.get(40, 60));} }

Output

輸出量

bs: {10, 20, 30, 40, 50, 60, 70, 80} bs.get(40): true bs.get(40,60): {0, 10}

翻譯自: https://www.includehelp.com/java/bitset-get-method-with-example.aspx

c bitset get

總結

以上是生活随笔為你收集整理的c bitset get_Java BitSet get()方法与示例的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。