Discover java code analysis tools, include the articles, news, trends, analysis and practical advice about java code analysis tools on alibabacloud.com
Java Split method source code Analysis1 PublicString[] Split (charsequence input [,intlimit]) {2 intindex = 0;//Pointers3 Booleanmatchlimited = limit > 0;//whether to limit the number of matches4ArraylistNewArraylist//Match result Queue5Matcher m = Matcher (input);//The character to be cut (string) matches the object, where is the pattern? 6 7 //ADD segments before each match found8 while(
(hashmap m) { linkedhashmap) m; if (LM. Accessorder) { lm.modcount+ +; remove (); Addbefore (lm.header); } } In the LRU algorithm, the least used pages are swapped out and most recently used are likely to be used later.He determines the Accessorder attribute, if true, executes an algorithm called LRU , removes the newly accessed entry and adds it to the front of the header, so that the iteration The i
reason for using a[i%m] is to prevent the array angle label out of bounds, such as M=10,i is from 0 to 9 this is a lap, and then i++ 10, 10%10=0,//The IF is not executed, but else I++,i is 11%10>0 to continue. Prevent a[10] Cross-border situations if(a[i%m]>0){ if(j%n==0) {//find the person who wants to go out and reduce the number of people in the circle by oneSystem.out.print (a[i%m]+ ""); A[i%m]=-1; J= 1;//someone's out of the loop, starting from 1 .i++; Len--; }Els
[Java concurrent programming] 18. PriorityBlockingQueue source code analysis,
PriorityBlockingQueue is an array-based thread-safe unbounded queue. Its principle and internal structure are basically the same as those of PriorityQueue, but there are multiple threads for security. 1: theoretically, it is unbounded, So adding an element may cause outofmemoryerror; 2.
Java-based Set source code analysis
The Set interface and implementation class are the simplest. The simple reason is that their implementation is based on the actual map implementation. For example, hashSet is based on hashMap, TreeSet is based on TreeMap, and CopyOnWriteArraySet is based on CopyOnWriteArrayList.
Therefore, the implementation is briefly analyzed
SourceSource Address public static int binarySearch(int[] a, int key) { return binarySearch0(a, 0, a.length, key); } public static int binarySearch(int[] a, int fromIndex, int toIndex, int key) { rangeCheck(a.length, fromIndex, toIndex); return binarySearch0(a, fromIndex, toIndex, key); } // Like public version, but without range checks. private static int binarySearch0(int[] a, int fromIndex, int toIndex,
This article gives you the content is about the Java Consumer Problem Code analysis, there is a certain reference value, the need for a friend can refer to, I hope you have some help.
1. Resources
public class Resource {//The number of current resources int num = 0; Upper limit of current resource int size = 10; Consumer resources public synchr
() {//Create an empty stack} PublicEPush(EItem) {//into the stackAddElement (item);returnItem;}//out of the stackPublic synchronizedEPop() {EObj;intlen = size ();obj = Peek ();Removeelementat (Len-1);returnObj;}//returns the top element of the stack, but not the stackPublic synchronizedEPeek() {intlen = size ();if(len = =0)throw NewEmptystackexception ();returnElementAt (Len-1);}//determine if the stack is emptyPublic BooleanEmpty() {returnSize () = =0;}//finds the element and returns the stack
Source code analysis of java Collection classes: Map (2), javamap
This section mainly discusses the differences and usage of Several implementation classes of the Map interface.1. Thread Security
Hashtable is thread-safe (similar to Stringbuffer and Vector), but not others. As for why, read some previous articles, which have been described in detail earlier.2. Ap
array whose value is located by the hash of the key, and then the Equals method to determine whether the value exists.Five otherHash method Finalinthash (objectk) {inth=hashSeed; if (0!=hkinstanceofstring) { returnsun.misc.hashing.stringhash32 ((String) k); }h^=k.hashcode ();// thisfunctionensuresthathashcodesthatdifferonlyby //constantmultiplesateachbitpositionhavea bounded//numberofcollisions (approximately8at Defaultloadfactor) .h^= (h>>>20) ^ (h>>>12);returnh^ (h>>> 7) ^ (hGT;GT;GT;NBSP;4)
(collection;//Remove objects that are not included in the collection default voidReplaceAll(unaryoperatorE> operator) {objects.requirenonnull (operator);FinallistiteratorE> li = This. Listiterator (); while(Li.hasnext ()) {Li.set (Operator.apply (Li.next ())); } }@SuppressWarnings({"Unchecked", "Rawtypes"})default voidSort(COMPARATORSuperE> C) {object[] a = This. ToArray (); Arrays.sort (A, (Comparator) c); listiteratorE> i = This. Listiterator (); for(Object e:a) {i.n
) { for(intindex = 0; index ) if(Elementdata[index] = =NULL) {fastremove (index); return true; } } Else { for(intindex = 0; index ) if(O.equals (Elementdata[index])) {fastremove (index); return true; } } return false; } Set/get method//Assigning a value to a specified position element PublicE Set (intindex, E Element) {Rangecheck (index);//Check Array statusE OldValue = elementdata (index);//check to show array subscript
Recommended Tools: Introduction to three automated code auditing tools 0 × 01
To do well, you must first sharpen your tools.
In static security auditing of source code, using automated tools instead of manual vulnerability mini
In SEO tools, we recommend Google website traffic statistics tools.
This traffic analysis tool is very powerful.
We will analyze each function block to help you maximize its value, not just to view traffic and keywords. The most important thing is to give you the minimum time to understand this tool.
"ConsoleOn the left-side navigation pane:
Console:
The homepage
About 0X01
工欲善其事, its prerequisite.
In the static security audit of source code, the use of automation tools instead of artificial vulnerability mining can significantly improve the efficiency of audit work. Learning to use automated code auditing Tools is an essential competency for every
Installing PHP xdebug Debugging tools and performance analysis tools Webgrind for WindowsFirst step : view information such as PHP versionPhpinfo ();above is x86 NTS VC14Step two : download xdebugofficial website https://xdebug.org/Step three :download Extension , add php /ext Extension directoryFourth Step : php.ini Open ExtensionTo configure additional option
.
4. PhpStorm
PhpStorm is a php ide rich application developed by JetBrains and supports refactoring. PhpStorm can help users adjust their encoding at any time, run unit tests, or provide visual debugging functions.
PhpStorm 7 is released. The new version supports PHP5.5, improved PHP syntax coloring performance, Vagrant, SSH Control remote tools, Drupal PHP frameworks, and improved debugging and testing performance.
Main features of PhpStorm:
1 Code editing tools 1.1 Source InsightSource Insight is a great code-editing software that supports the creation of project (which supports network creation at the same time), syntax coloring, Word association, and its code search function is very powerful and suitable for reading code.Is the full view of source insig
relationship between the various parts of the machine hardware requirements higher, compared to eat memory, at this time the running speed appears slow.
5, Oracle's JDeveloper
The oracle9i JDeveloper (version 9.0, up to 10g) provides a fully integrated development environment for building complex, multi-tier Java applications with the Java EE feature, XML, and Web services. It provides specia
://www.eclipse.org/gmf
Model development tools (MDT)
Utilities used to assist model development
Http://www.eclipse.org/mdt
M2M
Framework used for model conversion Language
Http://www.eclipse.org/m2m/
Model to text (m2t)
Utilities used to assist model development
Http://www.eclipse.org/m2t
Mylyn
Focus on task-based development
Http://www.eclipse.org/mylyn
Rich Ajax platform (RAP)
D
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.