java bitset

BitSet类intersects()方法 (BitSet Class intersects() method)

  • intersects() method is available in java.util package.

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

  • intersects() method is used to check the common number of bits set to true in both the BitSet [this BitSet and the given BitSet(bs)].

    intersects()方法用于检查BitSet [this BitSet和给定的BitSet(bs)]中设置为true的通用位数。

  • intersects() method is a non-static method, so it is accessible with the class object and if we try to access the method with the class name then we will get an error.

    intersects()方法是一种非静态方法,因此可以通过类对象进行访问,如果尝试使用类名称访问该方法,则会收到错误消息。

  • intersects() method does not throw an exception at the time of checking the common number of bits set to true in both the BitSet.

    在检查两个BitSet中都设置为true的通用位数时, intersects()方法不会引发异常。

Syntax:

句法:

    public boolean intersects(BitSet bs);

Parameter(s):

参数:

  • BitSet bs – represents the BitSet to intersect with this BitSet.

    BitSet bs –表示要与此BitSet相交的BitSet。

Return value:

返回值:

The return type of this method is boolean, it returns true when the given BitSet(bs) has bits set to true and the same bits set to true in this BitSet otherwise it returns false.

这种方法的返回类型是布尔值 ,当给定的位集合(BS)具有设置为true比特,并在此BitSet设置为true,相同比特否则返回 则返回true。

Example:

例:

// Java program to demonstrate the example
// of boolean intersects(BitSet bs) method of BitSet.
import java.util.*;
public class IntersectsOfBitSet {public static void main(String[] args) {// create an object of two BitSet
BitSet bs1 = new BitSet(10);
BitSet bs2 = new BitSet(10);
// By using set() method is to set
// the values in BitSet 1
bs1.set(10);
bs1.set(20);
bs1.set(30);
bs1.set(40);
bs1.set(50);
// By using set() method is to set
// the values in BitSet 2
bs2.set(60);
bs2.set(70);
bs2.set(50);
bs2.set(40);
bs2.set(30);
// Display Bitset1 and BitSet2
System.out.println("bs1: " + bs1);
System.out.println("bs2: " + bs2);
// By using intersects(BitSet) method is to check whether
// both the bitset has some common bits or not
boolean status = bs1.intersects(bs2);
// Display status
System.out.println("bs1.intersects(bs2): " + status);
}
}

Output

输出量

bs1: {10, 20, 30, 40, 50}
bs2: {30, 40, 50, 60, 70}
bs1.intersects(bs2): true

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

java bitset

java bitset_Java BitSet intersects()方法与示例相关推荐

  1. java散列法的运用实例,Java HashMap compute() 使用方法及示例

    Java HashMap compute() 使用方法及示例 Java HashMap compute()方法计算一个新值,并将其与哈希映射中的指定键相关联. compute()方法的语法为: has ...

  2. math的用法在java中的使用,Java Math cbrt() 使用方法及示例

    Java Math cbrt() 使用方法及示例 Java Math cbrt()方法返回指定数字的立方根. cbrt()方法的语法为: Math.cbrt(double num) 注意:cbrt() ...

  3. java arraylist 方法返回值,Java ArrayList get() 使用方法及示例

    Java ArrayList get() 使用方法及示例 Java ArrayList get()方法返回指定位置存在的元素. get()方法的语法为: arraylist.get(int index ...

  4. java bitset_Java BitSet and()方法与示例

    java bitset BitSet类和()方法 (BitSet Class and() method) and() method is available in java.util package. ...

  5. java bitset_Java BitSet clone()方法及示例

    java bitset BitSet类clone()方法 (BitSet Class clone() method) clone() method is available in java.util ...

  6. java bitset_Java BitSet hashCode()方法及示例

    java bitset BitSet类hashCode()方法 (BitSet Class hashCode() method) hashCode() method is available in j ...

  7. java bitset_Java BitSet cardinality()方法与示例

    java bitset BitSet类cardinality()方法 (BitSet Class cardinality() method) cardinality() method is avail ...

  8. java bitset_Java BitSet or()方法与示例

    java bitset BitSet类或()方法 (BitSet Class or() method) or() method is available in java.util package. o ...

  9. java bitset_Java BitSet nextClearBit()方法与示例

    java bitset BitSet类nextClearBit()方法 (BitSet Class nextClearBit() method) nextClearBit() method is av ...

最新文章

  1. LeetCode简单题之“气球” 的最大数量
  2. ORA-00845 : MEMORY_TARGET not supported on this system(调大数据库内存无法启动)
  3. 编程之美2.8 找符合条件的整数
  4. 网站基本建设必备窍门了解一下!
  5. 最常见的13种主数据管理(MDM)词汇和定义
  6. 如何写好技术文章(看张鑫旭老师的直播总结
  7. ug后处理如何加密_UG在NX加工中如何添加后处理文件?
  8. mac安装python3.8_mac安装pwntools(python3.8)解决多数问题
  9. jquery easyui datagrid js获取记录数 页数 当前页
  10. arial unicode ms字体_适合海报设计的最佳字体
  11. 使用Blend开发Silverlight VSM
  12. 如何改变WINDOWS服务的启动顺序(Win2000)
  13. 桌面计算机怎么覆盖文件,恢复被覆盖的文件_恢复被覆盖的桌面文件
  14. 【报告分享】2020年新一代人工智能白皮书-产业智能化升级(附下载)
  15. C#和NET Framework的定义
  16. Gini和AUC的关系(Gini=2AUC-1真的成立吗?)
  17. python模拟登录163邮箱_python selenium模拟登陆163邮箱。
  18. webstorm官网中文破解版(转自http://blog.csdn.net/vchen_hao/article/details/77248053)
  19. 微软浏览器edge对日期Date对象format(yyyy-mm-dd)/getDiff()方法不识别
  20. C语言学习日记(四)

热门文章

  1. @async 默认线程池_SpringBoot 线程池的使用
  2. 进程调度rr算法java实现_Java实现进程调度算法(二) RR(时间片轮转)
  3. IntelliJ IDEA最常用的一些快捷键,学会了室友还以为你在祖安对线
  4. LaTeX:equation, aligned 书写公式换行,顶部对齐
  5. HDFS-文件读写过程
  6. 修改gitlab数据卷的位置
  7. Web端H.265播放器研发解密
  8. Flask form(登录,注册)
  9. axis2开发webservice之编写Axis2模块(Module)
  10. 后缀数组 TYVJ P1860 后缀数组