Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use JavaScript's 36-ary addition

Shulou Source: shulou.com Published: 2022-06-01 23:34:21 09月28日 Update

This article mainly explains "how to use the 36-bit addition of JavaScript". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to use the 36-bit addition of JavaScript.

Public class Test36Bin {

/ * 36 decimal equals 1 * 36 ^ 1 + 11 * 36 ^ 0 = 36 + 11 * require the sum of any two 36 positive integers to be calculated according to the addition rule * for example: the conversion of'1b'to decimal equals 1 * 36 ^ 1 + 11 * 36 ^ 0 = 36 + 11 = 47 * Calculate'1b'+ '2x' =' 48' * * requirement: it is not allowed to convert 36 digits into decimal digits as a whole, calculate the sum of decimal numbers and then convert them back to 36 digits * * @ param args * / public static void main (String [] args) {String result = addFunWithStr ("1b", "2x") System.out.println ("result =" + result);} / * * get the value * @ param ch * @ return * / public static int getIntFromChar (char ch) {int ret =-1; if (ch > ='0' & & ch ='a'& & ch = 0 & & j > = 0) {char ch_1 = param1.charAt (I) Char ch_2 = param2.charAt (j); int v1 = getIntFromChar (ch_1); int v2 = getIntFromChar (ch_2); int ret = v1 + v2; if (ret > = 36) {int index = ret-36 + temp; char sv = symbol.charAt (index) StringBuffer.append (sv); temp = 1; / / carry} else {int index = ret + temp; char sv = symbol.charAt (index); stringBuffer.append (sv); temp = 0 While (I > = 0) {char ch_1 = param1.charAt (I); stringBuffer.append (ch_1); iMurray- } while (j > = 0) {char ch_2 = param2.charAt (I); stringBuffer.append (ch_2); jmurmuri;} StringBuffer result = stringBuffer.reverse (); return result.toString ();}

}

At this point, I believe you have a deeper understanding of "how to use JavaScript's 36-ary addition". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Binary addition number content decimal rule decimal learning practical deeper minimum two interest character practicality practical simple operation whole integer method Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology macOS Docker Xiaomi MariaDB