java bitset_Java BitSet or()方法與示例

java bitset

BitSet類或()方法 (BitSet Class or() method)

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

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

  • or() method is used to perform logical OR between this BitSet and the given BitSet(bs). This BitSet is updated when either this BitSet bit holds the value true or the given BitSet(bs) corresponding bit hold the value true.

    or()方法用于在此BitSet與給定的BitSet(bs)之間執行邏輯或。 當任此BitSet位保持值為true或給定的位集合(BS)對應位持有true值此BitSet被更新。

  • or() 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.

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

  • or() method does not throw an exception at the time of performing logical or operation.

    or()方法在執行邏輯或操作時不會引發異常。

Syntax:

句法:

    public void or(BitSet bs);

Parameter(s):

參數:

  • BitSet bs – represents a bit set.

    BitSet bs –表示一個位集。

Return value:

返回值:

The return type of this method is void, it returns nothing.

此方法的返回類型為void ,不返回任何內容。

Example:

例:

// Java program to demonstrate the example 
// of void or(BitSet bs) method of BitSet.
import java.util.*;
public class OrOfBitSet {
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 or() method is to perform
// logical OR between two BitSet(i.e. It returns
// all values set in any bitset )
bs1.or(bs2);
// Display BitSet 1
System.out.println("bs1.or(bs2) : " + bs1);
}
}

Output

輸出量

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

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

java bitset

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/540928.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/540928.shtml
英文地址,請注明出處:http://en.pswp.cn/news/540928.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

matlab 細化函數,MATLAB圖像處理工具箱函數(細化篇).doc

MATLAB圖像處理工具箱函數(細化篇)第3章 MATLAB數字圖像處理工具箱3.1 MATLAB圖像預處理3.1.1 圖像處理的基本操作1. 讀入并顯示一幅圖像clear %清除所有的工作平臺變量close all %關閉已打開的圖形窗口Iimread (pout.tif); %讀取圖像pout.tif(該圖像是圖像處理工具箱自帶的圖像…

STM32啟動解析

啟動方式對的不同下載模式 STM32可以通過BOOT引腳的配置,來選擇不同的啟動模式------對應不同的下載方式。 仿真器下載—— 內部FLASH的啟動方式 串口下載 —— 系統存儲器的啟動方式 內部SRAM一般不用,不講 啟動過程 以內部FLASH的啟動方式為例&am…

OpenBSD基金會收到錘子科技約140萬捐贈款

11月26日消息,給開源項目捐款一向是錘子科技發布會的傳統,去年發布會的門票收入捐給了國人章亦春主導的開源項目OpenResty。今年,錘子科技選擇將收益捐贈給OpenBSD基金會。OpenBSD基金會收到錘子科技約140萬捐贈款 OpenBSD基金會11月23日發布…

自動化部署kvm虛擬機_自動化虛擬助手

自動化部署kvm虛擬機The automated virtual assistant or commonly called personal assistants, are developed to serve its users by performing some tasks, setting reminders and much more based on the input is given and local awareness. It is integrated with a l…

php 數據庫編碼,php怎么設置數據庫編碼方式

在php中,可以使用mysql_query()函數來設置mysql數據庫的編碼方式;具體方法:在mysql_connect()語句之后添加“mysql_query("set names 編碼方式");”代碼即可。本教程操作環境:windows7系統、PHP7.1版,DELL G…

mysql截取字符串與reverse函數

mysql的函數大全: http://www.jb51.net/Special/606.htm 這個網頁上很多知識點,可以學習下,關于mysql的函數,也可以作為API查詢: 這里只說下mysql的截取函數和reverse函數: MySQL 字符串截取函數&#xff1…

flask sql外鍵使用_如何在SQL中使用外鍵?

flask sql外鍵使用Basically, Foreign Key represents relationship between tables. 基本上, 外鍵代表表之間的關系 。 Syntax: 句法: column-name data_type (size) CONSTRAINT constraint-name References Table-name (Column-name)Example: 例&a…

php發展歷,PHP的發展歷程

PHP的發展歷程了解一門語言,我們必須知道這門語言的發展史,現在我通過版本的變化以時間軸的形式來說明PHP的發展歷程。1.1995年初PHP1.0誕生Rasmus Lerdof發明了PHP,這是簡單的一套Perl腳本,用來跟蹤訪問者的信息。這個時候的PHP只…

中國互聯網安全大會將召開 網絡安全再獲關注

從2016中國互聯網安全大會籌委會獲悉,將于8月16日在國家會議中心召開的第四屆中國互聯網安全大會籌備工作已全部就緒。 據經濟參考報7月15日消息,中國網絡空間安全協會副理事長、360公司總裁兼企業安全集團董事長齊向東表示,此次中國互聯網安…

合并排序算法排序過程_外部合并排序算法

合并排序算法排序過程外部分類 (External sorting) External sorting is a technique in which the data is stored on the secondary memory, in which part by part data is loaded into the main memory and then sorting can be done over there. Then this sorted data wi…

php榛子云短信驗證,java + maven +榛子云短信 實現發送短信驗證碼功能

如何使用java maven的項目環境發送短信驗證碼,本文使用的是榛子云短信的接口。下載下來是jar文件,需要將jar發布到本地的maven倉庫中, 在cmd環境下輸入:mvn install:install-file -DgroupIdcom.zhenzi -DartifactIdsms -Dversion1.0.0 -Dpac…

django css_在應用程序上實現CSS Django的

django cssCSS (Cascade Style Sheets) are used to implement design. CSS(級聯樣式表)用于實現設計。 Step 1: Create a Sandbox, Activate it, Install Django and Create Sample Project 步驟1:創建一個沙箱,將其激活,安裝Django并創建示…

PHPWeb開發入門體驗學習筆記

PHPWeb開發入門體驗學習筆記4一、PHP web應用開發須知1.入門要點程序員三個階段:碼農(速成技能)->工程師(長期知識)->專家(研究論文)編程三要素:聲明變量(系統、全…

vb mysql 表格顯示,在VB中編輯數據庫和電子表格

在VB50中有很多功能強大的控件,其中數據控件與一些綁定控件(如文本框,圖片框及 ActiveX控件)的相互協作,能夠方便地實現對各種數據庫記錄、表格乃至電子表格的瀏覽和編輯操作。下面介紹實例,其中數據控件用于記錄的瀏覽、移動、…

c# datetime._C#| DateTime.AddTicks()方法與示例

c# datetime.DateTime.AddTicks()方法 (DateTime.AddTicks() Method) DateTime.AddTicks() method is used to return a new date-time object that adds ticks value of this instance. This object does not change the original value of date-time but it returns an objec…

12345組成三個不重復數java,求大神幫忙!五子棋!只能識別按順序識別!例如 12345 不能...

該樓層疑似違規已被系統折疊 隱藏此樓查看此樓import java.util.Arrays;import java.util.Scanner;public class Gobang {public static void main(String[] args) {Scanner sc new Scanner(System.in);boolean finish false;// 有戲是否結束int flagNum 1;// 當前下棋者標記…

[轉]Visual Studio 各版本下載

原文地址:[置頂] Visual Studio 各版本下載 文件名稱文件大小百度網盤下載微軟官方下載Visual Studio 2015 Enterprise - 企業版 - 簡體中文3.89GBhttp://pan.baidu.com/s/1bnAY68Bvs2015.ent_chs.isoVisual Studio 2015 Professional - 專業版 - 簡體中文3.84GBht…

JavaScript中的“ this”關鍵字

JavaScriptthis關鍵字 (JavaScript this keyword) The this keyword is widely used in JavaScript. It has many use cases and is also one of the most intimidating features of JavaScript. In most of the programming languages, this is used to refer to the current …

oracle 列級外鍵,Oracle外鍵列上是否需要索引?

外鍵列上缺少索引會帶來兩個問題,限制并發性、影響性能。而這兩個問題中的任意一個都可能會造成嚴重性能問題。 無論是Or外鍵列上缺少索引會帶來兩個問題,限制并發性、影響性能。而這兩個問題中的任意一個都可能會造成嚴重性能問題。無論是Oracle的官方文…

python 改變詞典順序_按詞典順序排列的功率集

python 改變詞典順序Description: 描述: This is a standard interview problem to find out the power sets in lexicographic order of a given set of numbers using backtracking. 這是一個標準的面試問題,它使用回溯來按給定數字集的字典順序查找能…