(String value) {Return match (V_unpositive_float,value);} /*** Verify URL* @param value to validate the string* @return If it is a string that conforms to the format, return */public static Boolean URL (String value) {Return match (V_url,value);} /*** Verify user registration. Matches a string consisting of a number, 26 letters, or underscores* @param value to validate the string* @return If it is a string that conforms to the format, return */public static Boolean UserName (String value) {Retu
A packaged and linked MySQL database tool class, you can easily get connection objects close statement, ResultSet, statment objects and so on
Copy Code code as follows:
Package myutil;
Import java.sql.Connection;
Import Java.sql.DriverManager;
Import java.sql.PreparedStatement;
Import Java.sql.ResultSet;
Import java.sql.SQLException;
Import java.sql.Statement;
/**
* Link MySQL Database
Java Project load configuration file tool class
Package com.loadproperties;
Import java.io.IOException;
Import Java.io.InputStream;
Import java.util.Properties;
public class Configutil {private static inputstream input;
Private volatile properties Configuration = new properties ();
A single instance of private
Hashcode code SYSTEM.OUT.PRINTLN (Arrays.tostring (a));//print out an array of } } 4, void Fill (array,val): assigns the array all elements to Val. //fill method: Replace all elements in the array with a value of int[] num={1,2,3}; //Parameter 1: Array object //Parameter 2: Replacement value Arrays.fill (num, 6); SYSTEM.OUT.PRINTLN (arrays.tostring (num));//Print Result: [6, 6, 6] 5, int binarysearch (array,val): Query element value val in array subscript //binarysearch: Find the subscrip
Tag:webtext algorithm retport fdaparseext validation Import Java.text.simpledateformat;import java.util.date;import java.util.hashmap;import java.util.Map;/** * ID information algorithm class * * @author Javaweb * */public class Cardutil {/** * According to the ID number of the current identity card holder's gender and age 18 ID Card * * @return * @throws Exception * * public static map
student is finished before opening:public class Countdownlatchtest {public static int numberofpeople = The number of students waiting for 10;//public static Boolean isgone = Fals e;//car Open sign public static int carwaittime = 3;//car etc time public static void main (string[] args) throws Interruptedexc eption {Countdownlatch Waitstudentsgeton = new Countdownlatch (numberofpeople); New Thread (New Geton (Waitstudentsg
); -}------------------------------------------------------------------------------------------------------* Objectmax (Collection): Returns the largest element in a given set based on the natural order of the elementObjectmax (Collection,comparator): Returns the largest element in a given set, based on the order specified by ComparatorObjectmin (Collection)Objectmin (Collection,comparator)Intfrequency (Collection,object): Returns the number of occurrences of the specified element in the specifi
Recently free time to tidy up a commonly used tools, repeating the wheel is a waste of time, if not correct or need to improve the place, welcome advice ... Packagecom.hsuchan.business.utils;ImportJava.io.File;ImportJava.io.FileOutputStream;Importjava.io.IOException;ImportJava.io.InputStream;ImportJava.net.URL;Importjava.util.Properties;ImportOrg.apache.log4j.Logger;/*** Java Properties File Operations Tool
We usually use the myabtis when not often need to use map to pass parameters, is generally the following steps:
public List
But if you need to put a lot of fields, and each property name is very long, it is very difficult to get, here can use the Java reflection method to automatically assemble the map, the following is the implementation of the blogger:
public class Test {//Implement eff
. * * This software are provided by the COPYRIGHT holders and CONTRIBUTORS ' as * is ' and any EXPRESS OR implied warranties, I Ncluding, LIMITED to, * The implied warranties of merchantability and FITNESS for A partIcular * PURPOSE is disclaimed. In NO EVENT shall the COPYRIGHT OWNER OR * CONTRIBUTORS is liable for any DIRECT, INDIRECT, incidental, special, * EXEMPLA RY, or consequential damages (including, but not LIMITED to, * procurement of substitute GOODS OR SERVICES; LOSS of Use, DATA, OR
Java string type-convert the hexadecimal literal value to the nominal value byte data tool class
private static byte hexValueOf(String hex) {byte result = 0;if (hex.charAt(0) == '0' (hex.charAt(1) == 'X' || hex.charAt(1) == 'x')) {for (int i = 2; i
System.out.println("
Java.util.concurrent.LockLock is more object-oriented than the synchronized in the traditional threading model, similar to the lock in life,The lock itself should also be an object. Code fragments executed by two threads to achieve the effect of a synchronous mutex, they must use the same lock object.Lock replacement synchronized classOutputer {lock lock=NewReentrantlock (); Public voidoutput (String name) {intLen =name.length (); Lock.lock (); Try{ for(inti = 0;
); Open URL connection java.net.HttpURLConnection httpconn = (java.net.HttpURLConnection) connurl. OpenConnection (); Set Common Properties Httpconn.setrequestproperty ("Accept", "*/*"); Httpconn.setrequestproperty ("Connection", "keep-alive"); Httpconn.setrequestproperty ("User-agent", "mozilla/4.0" (compatible; MSIE 8.0; Windows NT 6.1) "); Set Post mode Httpconn.setdoinput (TRUE); Httpconn.setdooutput (TRUE); Gets the output stream corresponding to the HttpURLConnection object out = new Print
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.