java. util. The arrays class makes it easy to manipulate an array, and all of the methods it provides are static. A static method belongs to a class, not to an object belonging to a class. So you can call directly using the class name plus the method name. arrays, as a
First, Countdownlatch Tool class IntroductionThe Countdownlatch class is one of the four most common tools used by Java concurrency Tools, and Countdownlatch allows one or more threads to wait for other threads to complete their work. Suppose we have such a demand, we need to parse a multi-sheet in Excel, this time we
Examples of some usage of the StringUtils tool class in Java
This article mainly introduces some usage examples of StringUtils tool class in Java. This article focuses on the use of isEmpty and isBlank methods, as well as the use
Original: Java read XML file generic tool class (recursive call) source code download address: http://www.zuidaima.com/share/1550463285480448.htm
The Java implementation reads the XML file and gets all the text content under the specified name node, including the node (inverse)
Package com.zuidaima.xml;
Import Java.i
Tags: MongoDB tool class MongoDB Java underlying driverUsing MONGODB requires a reasonable design of the document structure to meet certain specific requirements. For example, randomly selecting a document, skipping a random document with Skip and not adding a random key to the document.Then use a random number to query the document efficiently, the random key ca
1. dateutil. Java, the code is as follows:1 Packagecn.itcast_04;2 3 Importjava.text.ParseException;4 ImportJava.text.SimpleDateFormat;5 Importjava.util.Date;6 7 /**8 * This is the tool class for converting dates and strings to each other9 * Ten * @authorWind One */ A Public classDateutil { - PrivateDateutil () { - } the - /** - * The function of
The following Java generated two-dimensional code tool class, you can choose to generate files, or directly in the page generation
Import Java.awt.image.BufferedImage;
Import Java.io.File;
Import java.io.IOException;
Import Java.nio.file.FileSystems;
Import Java.util.HashMap;
Import Java.util.Map;
Import Javax.imageio.ImageIO;
Import Javax.servlet.http.HttpS
Publicstaticvoidmain (string[] args) {
inta[]={2,4,1,3,7};
Arrays.sort (a);
for (inti=0;i
System.out.println (A[i]);
}
To specify the ordering of array parts:Java code
Publicstaticvoidmain (string[] args) {
inta[]={2,4,1,3,7};
Arrays.sort (a,1,4); Output 2,1,3,4,7
for (inti=0;i
System.out.println (A[i]);
}
3.equals methodUsed to compare whether the element values in two arrays are equal or to see an array of type in
Arraytool. Java File
/** Static application. Each application has the public action function, which can be extracted and encapsulated independently for reuse because ArrayTool does not encapsulate special data, in addition, each method of the array does not use the specific data in ArrayTool. To make the program more rigorous, the methods in ArrayToll can be defined as static, you can call ArrayTool directly with the
+=Arr[x][y]; } } returnsum; } /*** Binary search * Precondition incoming array must be ordered *@paramarr passes an ordered array for validator *@paramkey incoming to search for data *@returnMid Returns the corner label of the search data in the array *@returnNo search data is found in the array, returns the inverse value of the insertion position of this data in this array*/ Public Static intBinarySearch (int[]arr,intkey) { intMin=0; intMax=arr.length-1; intmid;
First, when Java read the XML configuration file, always through the dom4j third-party library actively resolved, recently discovered that the JDK class library can be converted to Pojo XML.Ii. Writing XML conversion tool class XmlutilsPackage Com.moy.demo.common.utils;import Javax.xml.bind.jaxbcontext;import javax.xml
Original: Java implementation of the e-mail tool class, easy to use (need to rack the package of send Email to me)Source code: Http://www.zuidaima.com/share/1550463394794496.htmPackage Com.zuidaima.util;import Java.util.properties;import Javax.mail.bodypart;import javax.mail.Message;import Javax.mail.multipart;import Javax.mail.session;import Javax.mail.transport
Example 1. Organize a reusable date formatting tool class that is not necessary for programmers who are miserable in daily developmentHere's how to contribute to the Java Date Tool class code:
The code is as follows
Copy Code
/*** Date
in the collection with the new values. 6,collections.reverse (list);//Flips the entire list7,collections.reverseorder ();//Returns a comparator object in reverse. TreeSetAdvanced for LoopFormat for (data type variable name: traversed collection or array) {SOP (variable name); but cannot be modified, can only be removed, principle or iterator}import java.util.*; public class Test {public static void main (string[] args) {arraylistvariable ParametersA
Original: Java HTML string Regular expression using the tool classCode: http://www.zuidaima.com/share/1550463453416448.htmHTML-related Regular expression tool classes include filtering HTML tags, converting HTML tags, replacing specific HTML tags Package Com.zuidaima.common.util;import Java.util.regex.Matcher; Import Java.util.regex.Pattern; /** *
and consumes the license (the license becomes unavailable) and, if the license is unavailable, is blocked.The Unpark () method, in turn, makes a license available.This feature makes it possible for the next park () operation to return immediately, even if the Unpark () operation occurs before Park (). This is why the above example code ended successfully.At the same time, the park () suspended thread will not be as suspend () as the thread state Runnable,park () will explicitly give the waiting
Array Tool class arraysSome of the static modifiers contained in the arrays class provided by Java can manipulate arrays directly. If the method in the inside is cooked, then the development efficiency will be greatly improved. The methods are described below.ListFunction: Converts the specified array or array element
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.