javaÔõôʵÏÖ·ÖÒ³
1.PaginationTable.java
package com.sinoest.train.common;
import java.util.List;
/**
* ·ÖÒ³±í
* @author ÀîÒ×烜-ÐÞ¸Ä
* 2009-6-17
*/
public class PaginationTable {
private List<?> entryList;//> Êý¾Ý
private int totalNumOfRows;// ×ÜÐÐÊý
private int rowsPerPage = 10;// ÿҳÐÐÊý
private int beginIndex = 0;//---> µ±Ç°Ò³ÆðʼÐÐ
private int endIndex;//-----> ÖÕÖ¹Ò³
private int pageIndex;//----> µ±Ç°Ò³
private int pageCount;//----> ×ÜÒ³Êý
public PaginationTable(){ }
public PaginationTable(int totalNumOfRows, int pageIndex) {
//super();
if(pageIndex<=0){
pageIndex=1;
}
this.totalNumOfRows = totalNumOfRows;
if(totalNumOfRows%rowsPerPage==0){
this.pageCount = this.totalNumOfRows/rowsPerPage;
}else {
this.pageCount = this.totalNumOfRows/rowsPerPage+1;
}
if(pageIndex > pageCount){
pageIndex = pageCount;
}
this.pageIndex = pageIndex;
if(totalNumOfRows > 0){
this.beginIndex = (pageIndex-1)*rowsPerPage;
}
this.endIndex = pageIndex*rowsPerPage;
endIndex = endIndex>this.totalNumOfRows ? this.totalNumOfRows : endIndex;
}
public PaginationTable(int rowsPerPage, int totalNumOfRows, int pageIndex) {
//super();
this.rowsPerPage = rowsPerPage;
if(pageIndex<=0){
pageIndex=1;
}
this.totalNumOfRows = totalNumOfRows;
if(totalNumOfRows%rowsPerPage==0){
this.pageCount = this.totalNumOfRows/rowsPerPage;
}else {
this.pageCount = this.totalNumOfRows/rowsPerPage+1;
}
if(pageIndex > pageCount){
pageIndex = pageCount;
}
this.pageIndex = pageIndex;
if(totalNumOfRows > 0){
this.beginIndex = (pageIndex-1)*rowsPerPage;
}
this.endIndex = pageIndex*rowsPerPage;
endIndex = endIndex>this.totalNumOfRows ? this.totalNumOfRows : endIndex;
}
/** ×ÜÒ³Êý£¬×îÉÙÒ»Ò³£¬0ÐÐÒ²°´Ò»Ò³¼ÆËã */
public int getTotalNumOfPage() {
return this.totalNumOfRows / this.rowsPerPage + 1;
}
/** Êý¾Ý */
Ïà¹ØÎĵµ£º
1. MD5¼ÓÃÜ£¬³£ÓÃÓÚ¼ÓÃÜÓû§ÃûÃÜÂ룬µ±Óû§Ñé֤ʱ¡£
¡¡ ¡¡protected byte[] encrypt(byte[] obj) ...{
¡¡¡¡try ...{
¡¡¡¡MessageDigest md5 = MessageDigest.getInstance("MD5");
¡¡¡¡md5.update(obj);
¡¡¡¡return md5.digest();
¡¡¡¡} catch (NoSuchAlgorithmException e) ...{
¡¡¡¡e.printStackTrace();
¡ ......
package testPackage;
class Test {
public static void main(String[] args) {
String hello = "Hello", lo = "lo";
System.out.print((hello == "Hello") + " ");
System.out.print((Other.hello == hello) + " ");
System.out.print((other.Other.hello == hello) + " ");
System.out.print((hello == ("Hel"+"lo ......
ÕýÔò±í´ïʽÔÚ×Ö·û´®´¦ÀíÉÏÓÐ×ÅÇ¿´óµÄ¹¦ÄÜ£¬sunÔÚjdk1.4¼ÓÈëÁ˶ÔËüµÄÖ§³Ö
ÏÂÃæ¼òµ¥µÄ˵ÏÂËüµÄ4ÖÖ³£Óù¦ÄÜ£º
²éѯ£º
ÒÔÏÂÊÇ´úÂëÆ¬¶Î£º
String str="abc efg ABC";
String regEx="a|f"; //±íʾa»òf
Pattern p=Pattern.compile(regEx);
Matcher m=p.matcher(str);
boolean rs=m.find();
Èç¹ûstrÖÐÓÐregEx£¬ÄÇôrsΪtru ......
1Ê×ÏÈÌí¼ÓÐÞ¸ÄͼƬ¿í¶ÈºÍ¸ß¶ÈµÄ·½·¨
public static void reduceImg(String imgsrc, int widthdist, int heightdist) {
try {
File srcfile = new File(imgsrc);
if (!srcfile.exists()) {
return;
}
......
ÀûÓÃJNI¼¼Êõ£¬¿ÉÒÔ×öµ½C/C++ÓëJavaÖ®¼äµÄÏ໥µ÷Óá£
1¡¢Javaµ÷ÓÃC/C++½Ó¿Ú
Õâ¸öÊÇJNI×î»ù±¾µÄÓ¦Óã¬JNIÓкܶàÕâ·½ÃæµÄÀý×Ó´úÂë¡£Ò»°ã°ÑC/C++д³É¶¯Ì¬Á´½Ó¿â£»ÔÚJava³ÌÐòÔÚLoadLibrary£¬ÀûÓÃnative½Ó¿Ú£¬¼´¿ÉÍê³Éµ÷Óá£
2¡¢C/C++»Øµ÷Java½Ó¿Ú
ÕâÖÖÓ÷¨£¬JNIµÄÀý×ӱȽÏÉÙ¡£Æäʵ£¬Ò²±È½Ï¼òµ¥£¬JNIÒ²ÌṩÁËÕâÑùµÄ½Ó¿Ú¡ ......