The examples in this article describe the regular tool classes for Java implementations. Share to everyone for your reference. Specifically as follows:
The regular tool class implemented here is applicable to: regular telephone number, mailbox, QQ number, QQ password, mobile phone number
The
columnlisthandler the field values of the columns specified in the result set into a list collection Scal Arhandler It is used for single data.
For example, select COUNT (*) from table operation.
*/queryrunner QR = new Queryrunner ();
Connection conn = Jdbcutil.getconnection ();
/** Arrayhandler *//1 String sql = "SELECT * from user LIMIT?";
Object[] params = {1};
object[] Objarrayhandler = qr.query (conn, SQL, New Arrayhandler (), params);
System.out.println (Objarrayhandler[0
In Java EE configuration files, such as XML or properties files, because some sensitive information does not want to be seen by ordinary people, it can be stored in an encrypted manner and decrypted after the program is read.
Common such as: Database user password, SMS platform user password, system calibration of fixed passwords.
This tool class refers to the "s
Original: Java Date manipulation Tool classSource code: Http://www.zuidaima.com/share/1550463481580544.htmHere are some of the commonly used date processing methods, written is very comprehensive, I hope someone can write their own good date processing code updated into the insidePackage Com.zuidaima.date.util;import Java.text.parseposition;import Java.text.simpledateformat;import Java.util.calendar;import
In the project we use Java often have the use of authentication function, such as mobile phone number, password and other authentication.To summarize, write a tool class to facilitate the use of the next time directly cited.Package com.common.utils;Import Org.apache.commons.lang3.StringUtils;Import Java.util.regex.Matcher;Import Java.util.regex.Pattern;public
; Ftp.connect (host, Port); //If you use the default port, you can connect directly to the FTP server using Ftp.connect (host)Ftp.login (username, password);//LoginReply =Ftp.getreplycode (); if(!ftpreply.ispositivecompletion (Reply)) {Ftp.disconnect (); returnresult; } ftp.changeworkingdirectory (RemotePath);//Transfer to FTP server directoryftpfile[] fs =Ftp.listfiles (); for(Ftpfile ff:fs) {if(Ff.getname (). Equals (FileName)) {File LocalFile=NewFile (LocalPath + "/
Scenario: Normally our user-registered password is saved to the database and will not be stored in plaintext. are encrypted. Because the security of the user is guaranteed. We usually use the MD5 algorithm to encrypt it.This can only be regarded as a tool class. There is no need to know how it is implemented. You can use it to get it.Md5util.java PackageCom.mmall.util;Importlombok.extern.slf4j.Slf4j;Importj
Array has tool class, aspect manipulation arrayThe collection also has a tool class: collectionsExamples of common methods: Packagedemo;Importjava.util.ArrayList;Importjava.util.Collections;Importjava.util.List; Public classCollectiondemo { Public Static voidMain (string[] args) {function1 (); Function2 (); F
) {Iarr[i]=value; } } /*** Modifies the value of the specified index of a one-dimensional array and does not modify if the index is out of bounds. * * @paramIarr * Original array *@paramIndex * Indexes *@paramValue * Values*/ Public Static voidSetint[] Iarr,intIndexintvalue) { if(Noarrayindexoutofbounds (iarr.length, index)) Iarr[index]=value; } /*** Sets the value of the specified index for the two-dimensional array. * * @paramIarr * Two-dimensional array *@paramx
The Countdownlatch counter can only be used once. The Cyclicbarrier counter can be reset using the Reset () method. So cyclicbarrier can handle more complex business scenarios, such as resetting the counters and having the threads perform them again if the calculations are wrong.
Cyclicbarrier also provides other useful methods, such as the Getnumberwaiting method, to get the number of threads Cyclicbarrier blocked. The IsBroken method is used to know if the blocked thread is inter
This example of this article for you to share the Java Date Operations Tool class, get the specified date the day before, the following days, date conversion, two dates, and other tools for reference, the details are as follows
Import java.text.ParseException;
Import Java.text.SimpleDateFormat;
Import java.util.ArrayList;
Import Java.util.Calendar;
Import
A simple zip compression decompression Tool class written using Java base classes
Copy Code code as follows:
Package sun.net.helper;
Import java.io.*;Import Java.util.logging.Logger;Import java.util.zip.*;public class Ziputil {Private final static Logger Logger = Logger.getlogger (ZipUtil.class.getName (
Package com.xushouwei.cn;Import Java.util.HashMap;Import Java.util.Map;Import Org.junit.Test;Import Cn.itcast.commons.CommonUtils;/*** Test Commonutils class* @author Administrator**/public class Commonutilstest {/*** Test: Returns a random 32-bit long string* Commonutils class-dependent jar packageUse* 1. Used to make ID, the primary key in the database table ca
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.