Asking for help: help me change the CRC4 algorithm implemented in C to implemented in Java, thank you
Verification content: 01 01 00 00 00 09 00 90 55 16 01 10 16 01 10 Verification result: 55 C6 Verification content: 01 01 00 00 00 09 00 91 C0 A8 01 01 00 C1 A9 Verification result: 30 49 void CalulateCRCbySoft(unsigned char *pucData,unsigned char wLength,unsigned char *pOutData) { unsigned char ucTemp; unsigned int wValue; Unsigned int crc_tbl[16]={0x0000,0x1021,0x2042,0x3063,0x4084,0x50a5,0x60c6,0x70e7, 0x8108,0x9129,0xa14a,0xb16b,0xc18c,0xd1ad,0xe1ce,0xf1ef}; //Four-digit remainder table wValue=0; //The CRC remainder of this byte is equal to the lower 12 bits of the CRC remainder of the previous byte, shifted left by 4 bits, //Add the CRC remainder of the previous byte and shift it 4 bits to the right (also take the high 4 bits) and the sum of this byte and the CRC code obtained while(wLength–!=0) { //According to the four-digit CRC remainder table, first calculate the high four-digit CRC remainder ucTemp=((wValue>>8))>>4; wValue<<=4; wValue^=crc_tbl[ucTemp^((*pucData)>>4)]; //Calculate the lower four digits of the remainder ucTemp=((wValue>>8))>>4; wValue<<=4; wValue^=crc_tbl[ucTemp^((*pucData)&0x0f)]; pucData++; } pOutData[0]=wValue; pOutData[1]=(wValue>>8); } 2 solutions #1 I don’t understand the principle of CRC4. If you explain it more clearly, I can make it. #2 import java.util.ArrayList; import java.util.List; public class CRC4 { static void CalulateCRCbySoft(int[] pucData, List pOutData) { byte ucTemp=0; int wValue=0; int[]…
Find the average in Java, array implementation, thank you!
Enter a set of numbers from the console and store them in an array, separated by spaces, and find the average of the entered numbers. Thank you! … 12 solutions #1 If input 24 23 34.5 77 89 Enter the average of the five numbers above… #2 A Java beginner has sent me a small program. Its functions are a bit different from those of LZ. I input a number and press Enter and then another number. Feel free to comment on the bad points! import java.util.Scanner; public class Average { public static void main(String[] args) { System.out.println(“How many numbers do you want to find the average of?”); int s; Scanner sc = new Scanner(System.in); s = sc.nextInt(); System.out.println(“Please enter the average of the number of “+s+” you require: “); double[] my_array = new double[s]; double num=0; for(int i=0;i<s;i++) { double a; Scanner aa = new Scanner(System.in); a = aa.nextFloat(); my_array[i]=a; num+=my_array[i]; } System.out.println(“The average of the number of “+s+” you are looking for is “+num/2); } } #3 This kind of direct code is probably a trap #4 Please refer to the following: package CSDN; import java.util.Scanner; public class ArrAverage { public static void main(String[] args) { System.out.println(“Please enter…
Java generates QR code tool class, personal test is effective, please indicate the source when reprinting, thank you!
To use the tool class, you need to introduce the jar package required for QR code processing into the project 1.pom.xml is added first com.google.zxing core 3.3.0 com.google.zxing javase 3.3.0 Of course, because the jar taken directly from Google is a bit bloated, interested students can download the complete code for research from the zxing project on the official website, or they can directly take out the code in the project and then encode it. The address is here https://github.com/zxing/zxing/releases. Time is precious, so keep reading! 2. After introducing the jar package, directly maven update, then copy the following code to the project to use it, generate the QR code encode, and identify the QR code decode. package com.zhha.common.Util; import java.awt.BasicStroke;import java.awt.Graphics;import java.awt.Graphics2D;import java.awt.Image;import java.awt.Shape;import java.awt.geom.RoundRectangle2D; import java.awt.image.BufferedImage;import java.io.File;import java.io .OutputStream;import java.util.Hashtable;import java.util.Random; import javax.imageio.ImageIO; import com.google.zxing.BarcodeFormat;import com.google.zxing.BinaryBitmap;import com.google.zxing .DecodeHintType;import com.google.zxing.EncodeHintType;import com.google.zxing.MultiFormatReader;import com.google.zxing.MultiFormatWriter;import com.google.zxing.Result;import com.google.zxing.client.j2se. BufferedImageLuminanceSource;import com.google.zxing.common.BitMatrix;import com.google.zxing.common.HybridBinarizer;import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; /** * QR code processing tool class * @author duzhj * @date 2019.1.17 */public class QRCodeUtil { private static final String CHARSET = “utf-8”; private static final String FORMAT_NAME = “JPG”; // QR code size private static final int QRCODE_SIZE = 300; // LOGO width private static final int WIDTH =…
If a PB programmer wants to change careers, is it better to develop to JAVA or .NET? Please give me your opinion, thank you!
I am now a PB programmer and have been working for more than a year. My major in programming language in college was JAVA. After graduation, when I was looking for a job, I found a job as a PB programmer by accident, and I changed jobs once in the process. , now works as PB technical support in a company. I like technology and plan to take the technical route, but the development space of PB is limited on the technical route, so I plan to change careers. I want to continue working on JAVA, but there are too many things to learn in JAVA. Although I studied it for more than a year before, and I also bought some books and read some after work, but after all, I am quite busy with work, and it is just for learning. Time is really limited, and I still feel like I’ve forgotten most of it. I have learned a bit about .NET before, and I feel that I can get started relatively quickly. Now is the time for me to make a decision. I’m a little confused. Please give me some advice! 10 solutions #1 it’s the same Learn…
Please download the full text of “The Art of JavaScriptDOM Programming” for free from Baidu Netdisk resources, thank you~
Please download the full text of “Javascript DOM Programming Art” for free from Baidu Netdisk resources, thank you~ “Javascript DOM Programming Art” Baidu Netdisk pdf latest complete set download: Link: https://pan.baidu. com/s/1-_vYmPfUVIue4p7uDqHDDQ ?pwd=g9nc Extraction code: g9nc Introduction: Javascript is the most important language in Web development. It is powerful and beautiful. Whether it is desktop development or mobile applications. Javascript is a technology that must be mastered. W3C’s DOM standard is the cornerstone of developing Web applications. It is supported by all modern browsers, making cross-platform web development a breeze. “The Art of Javascript DOM Programming (2nd Edition)” pdf download for online reading, please ask for Baidu Netdisk cloud resources “The Art of Javascript DOM Programming (2nd Edition)” ([English] Jeremy Keith) e-book network disk download free online reading Resource link: Link: https://pan.baidu.com/s/1cCbWo-yM6JWffag7jdY-fw Extraction code: 47ci Book title: The Art of Javascript DOM Programming (2nd Edition) Author: [English] Jeremy Keith Translator: Yang Tao Douban score: 8.6 Publisher: People’s Posts and Telecommunications Press Year of publication: 2011-4 Number of pages: 300 brief introduction: Javascript is the most important language in web development. It is powerful and beautiful. Whether it is desktop development or mobile applications. Javascript is a technology that must be…
I want to find an open source website building system or CMS, Java, with better quality and more functions, and accept commercial open source. Please help and recommend, thank you
I want to find an open source website building system or CMS, Java, with better quality and more functions, and accept commercial open source. I have searched a lot and haven’t found anything satisfactory. So please help me recommend, thank you. Answer Go to Jisu Gang to publish, someone should help you Quote the comment from “jisubang” Go to Jisu Help publish, someone should help you I think if no one knows about OSC, there is no need to ask elsewhere. Thank you for your answer & advertisement. PublicCMS I recommend jpress, which is relatively stable and can be developed using plug-ins and templates. It’s also easier to get started
If you use JavaScript to get the tag value in struts2, wait online, thank you
As title. Please give some advice from experts. Please don’t tell me to directly add the id to the tag. If possible, I won’t bother everyone by posting. Thanks 11 solutions #1 Go up yourself. #2 Please help me take a look at it, don’t let yourselves be blamed. #3 Just take it directly. var a = ‘‘; #4 I’ll give it a try. #5 Quoting the reply from the poster yehanyy: As title. Please give some advice from experts. Please don’t tell me to directly add the id to the tag. If possible, I won’t bother everyone by posting. Thanks This js cannot be obtained. You need to know that js can get the value of the page tag element. But , after generating html, only a single value is left. no tags #6 So what should I do if I want to reassign ? #7 Oh, I understand, thank you. Why do I reassign in js? The typeId obtained here is still the original value. #8 Add an id attribute Calling document.getElementById(“attribute name”).getAttribute(“value”) can be obtained. Can you try it? #9 Add an id attribute Calling Document.getElementById(“ID name”).getAttribute(“value”) can be used. Can you try it? #10 I must…
I don’t know what’s wrong with the Java class name, thank you!
Software: idea; the software can be run, submit it to Luogu and prompt (/tmp/compiler_5noy00th/Main.java:5: Error: Class Test is public, public class should be declared in a file named Test.java Test {) 123 45678910111213 141516171819202122 import java.util.Scanner; public class Test { public static void main(String[] args) { int A,B,C;double SUM; Scanner scanner=new Scanner(System.in); System.out.println(” Please enter your three grades”); A=scanner.nextInt(); if (A>=0&&A<=100) { B & # 061; scanner.nextint (); if (b> & # 061; 0 && b <& # 061; 100) { C & # 061; scanner.nextint ( ; ;C*0.5; System.out.println(“Your final score is “+SUM); > > Answer: There can be countless class names in a .class file, but there can only be one class name with public class, and the .class file name It must be consistent with the class name of the public class. This is the Java specification.
——————javacollection set learning—-Xiaobai’s study notes, if there are any mistakes, please point them out, thank you
java object collection learning record java collection collection learning collection Collection is an interface, so it cannot be instantiated, only through its subclass xxxxxxxxxx Method to create Collection object: 1.Collection c = new ArrayList ();At this time, c is a Collection an object instantiated Arraylist xxxxxxxxxx 1.Add object members: collection object. add(Object to be added);(add method is always will succeed, only true) will be returned 2.Clear all objects: collection objects. clear(); 3.Clear a single object: a collection object. remove(Specified object); Clear the specified object Drop 4.Determine whether the collection contains elements: collection object.inEmpty();return true, false 5.Judge the number of objects in the collection: collection object.size(); Returns the number of objects in the collection 6.Add an a collection to another b collection :b.addAll(a span>);(allow the existence of duplicate objects) 7.Remove all items in set a that are contained in combination b Element: a.removeAll(b);(Return true as long as one element in b is removed) 8.Determine whether set a contains all objects of b:a.containsAll(b);Returns true only when all are included 9.Find the intersection of objects in two collections: retainAll() eg: Premise set a,set b a.retainAll(b) Communicative…
What is the function of java select statement_Java novice, please help me comment out each statement block, what is its function and purpose, thank you! ! …
①importjava.util.ArrayList;importjava.util.List;publicclassB{publicstaticvoidmain(String[]args){ArrayListm=newArrayList(100);for(inti=0;i<100;i+ +){m.add(i+1);}Objectn=nu… ① import java.util.ArrayList;import java .util.List; public class B { public static void main(String[] args) { ArrayList m = new ArrayList(100); for (int i = 0; i <100; i++) { m.add(i + 1); } Object n = null; while (m.size() > 2) { m = sy(m, m.size( )); } n = m.get(1); System.out.print(n); } public static ArrayList sy(List s, int num) { ArrayList list = new ArrayList(); if (num % 3 != ; 0) { for (int i = num % 3; i > 0; i–) { list.add(s.get(num – i)); System.out.println(list); } } for (int i = 1; i <num – num % 3; i+ +) { if (i % 3 != 0) list.add(s.get(i – 1)); } return list; } } ② import java.util.Arrays;import java.util.Scanner; public class A { public static void main(String[] args){ Scanner input = new Scanner(System.in); System.out.print (“Please enter the total number of people:”); int p = input.nextInt(); boolean[] per = new boolean[p]; int num = 0; for(int i=0;i<per.length;i++){ per[i] = true; } int t = 0 , len = per.length; while(len>1){ for(int i = 0; i if(per[i]){ t++; if(t == 3){ t = 0 ; per[i] = false; len–; num++; System.out.print (“num:”+num); } } }…