Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

The method of java binary Multi-field matching

Shulou Source: shulou.com Published: 2022-06-02 08:58:54 09月12日 Update

This article mainly explains the "java binary multi-field matching method", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's train of thought slowly in depth, together to study and learn "java binary multi-field matching method" bar!

Package util;/** merges multiple int positive integers into a long type for storage, and calculates whether the two groups of int match by xor operation * the value of MultiEnumVal64 int positive integers must be greater than 0 and 0 for the special calculation of MultiVal64 itself, b as an example * * String sql = ""; * if (mv643.isHasIgnoreVal ()) {* sql = "select * from table where column_name (") * for (int [] pos: mv643.getIgnorePos ()) {* if (pos [0] > 0 | | pos [1] > 0) {* for (int start = pos [1]; start b as an example * * String sql = ""; * if (mv643.isHasIgnoreVal ()) {* sql = "select * from table where (column_name & ~"; * sql + = mv643.getComparVal ()) * sql + = ") ^" + mv643.getLong () + "= 0;"; *} else {* sql = "select * from table where column_name ^" + mv643.getLong () + "= 0;"; *} * * / public class MultiEnumVal64 {/ * binary length container for the maximum value of all attributes * / private int [] config / * ignore locations that do not participate in matching values * / private int [] [] ignorePos; / * binary values * / private long longVal; / * the binary length synthesis of the maximum value of all attributes * / private int length; / * whether there is no participation in the matching identity * / private boolean hasIgnoreVal = false / * * the maximum value of each group of int * * @ param maxValConfig * / public MultiEnumVal64 (int... MaxValConfig) {this.config = new int [maxValConfig.length]; this.ignorePos = new int [maxValConfig.length] [2]; for (int index = 0; index)

< maxValConfig.length; index++) { int maxVal = maxValConfig[index]; if (maxVal < 0) { throw new IllegalArgumentException("value must be greater than 0"); } int tempLength = Integer.toBinaryString(maxVal).length(); this.config[index] = tempLength; length += tempLength; } if (length + 1 >

63) {throw new IllegalArgumentException (length + "over the maximum digit 62");}} / * * value 1) {startIndex = 1; values [I] = Integer.parseInt (binary.substring (startIndex, endIndex), 2);} else {values [I] =-1 }} else {values [I] = Integer.parseInt (binary.substring (startIndex, endIndex), 2);} if (values [I] = = 0) {values [I] =-1;} endIndex = startIndex;} return values } public int [] [] getIgnorePos () {return ignorePos;} public int getLength () {return length;} public long getComparVal () {long M1 = 0L If (hasIgnoreVal) {for (int [] pos: ignorePos) {if (pos [0] > 0 | | pos [1] > 0) {for (int start = pos [1]; start)

Tags: Data attributes binary glasses maximum hat color field method scene maximum order success hat object database clothing length learning query Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Redmi Huawei MySQL macOS