import java.util.*;
import java.text.*;
/**
* a <code> DateTime </code> 定义了日期时间的一些便捷的格式化操作
*
* @version 1.0
* @author markhuang
*/
public class DateTime {
/**
* 存储时间和日期,默认当前时间和日期
*/
// private Calendar cale = Calendar.getInstance();
private Calendar cale = new GregorianCalendar();
/**
* 默认构造函数,得到当前时间和日期
*/
public DateTime() {
cale.setLenient(false);
}
/**
* 构造函数,可设置毫秒
*
* @param millisecond
* 过去的毫秒数
* @see #DateTime
*/
public DateTime(long millisecond) {
cale.setLenient(false);
cale.setTimeInMillis(millisecond);
}
/**
* 构造函数,可设置年月日时分秒
*
* @param year
* 年
* @param month
* 月
* @param day
* 日
* @param hour
* 小时
* @param minute
* 分钟
* @param second
* 秒
* @see #DateTime(long)
*/
public DateTime(i ......
import java.awt.image. * ;
import com.sun.image.codec.jpeg. * ;
public class poiReadDoc {
Image img = null;
int width = 0,height =0;
String destFile = "";
public void readImg(String fileName) throws IOException{
File _file = new File(fileName); // 读入文件
// String srcFile = _file.getName();
destFile = fileName.substring( 0 , fileName.lastIndexOf(".")) + " _mini.jpg " ;
img = javax.imageio.ImageIO.read(_file); // 构造Image对象
width = img.getWidth( null ); // 得到源图宽
height = img.getHeight( null ); // 得到源图长
}
public void resize( int w, int h) throws IOException & ......
ArrayList是最常用的List实现类,内部是通过数组实现的,它允许对元素进行快速随机访问。数组的缺点是每个元素之间不能含有“空隙”,当数组大小不满足时需要增加存储能力,就要将已有数组数据复制到新的存储空间中。当从ArrayList的中间位置插入或者删除元素时,需要对数组进行复制、移动,代价比较高。因此,它适合随机查找和遍历,不适合插入和删除。
Vector与ArrayList一样,也是通过数组实现的,不同的是它支持线程的同步,即某一时刻只有一个线程能够Vector,避免多线程同时写而引起的不一致性,但实现同步需要很高的花费,因此,访问它比访问AarryList慢
LinkedList是用链表结构存储数据的,很适合数据的动态插入和删除,随机访问和遍历速度比较慢。另外,它还提供了List接口中没有定义的方法,专门用于操作表头和表尾元素,可以当做堆栈、队列和双向队列使用。
*/
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Stack;
import java.util.Vector;
/**
* 演示各种List的使用
* List是能维护元素的次序,它允许元素重复
......
http://blog.sina.com.cn/s/blog_503cf9f80100b9lf.html
java时间函数(2008-12-06 22:25:46)
<> 标签:杂谈
注意:java.util和java.sql中都有Date这个类,不知道用哪一个了,你可以写死java.sql.Date time = .....
1. Java计算时间依靠1970年1月1日开始的毫秒数. &n ......
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
System.out.println(sdf.format(date));
SimpleDateFormat sdf2 = new SimpleDateFormat("MM");
System.out.println(sdf2.format(date));
Calendar c = Calendar.getInstance();
System.out.println(c.get(Calendar.MONTH)+1);
Date d=new Date(2010,5,12,13,24,30);
c.setTime(d);
System.out.println(c.get(Calendar.MONTH)+1);
--------------------------------------------------------------------
test=new JdbcTest();
String sql="{call proc_select3(?)};"; //调用语句
try {
CallableStatement proc=test.getConnection().prepareCall(sql);
proc.setString(1, "男");
//proc.execute();
ResultSet rs= proc.executeQuery();
while(rs.next())
{
System.out.print("id: "+rs.getInt("id"));
&n ......
来个简单点的:
1.建个具体的服务实现:
package com.webservice;
@WebService
public class Warehouse {
private Map<String, Double> prices;
public Warehouse() {
prices = new HashMap<String, Double>();
prices.put("Blackwell Toaster", 24.95);
prices.put("ZapXpress Microwave Oven", 49.95);
}
public double getPrice(@WebParam(name = "description")
String description) {
Double price = prices.get(description);
return price == null ? 0 : price;
}
}
2。生成存根(stub) 的classes,在RMI中这会自动生成。WebService中可用JAX-WS工具生成:
进到工程的classes目录下:
wsgen -classpath . com.webservice.Warehouse
在com.webservice.jaxws中会生成一些class类,在这里的是GetPrice.class和GetPriceResponse.class
其实也就是把参数和返回值包装的类。
3。是时候部署了,在这里,我们用jdk提供的简单机制:
package com.webservice;
public class WarehouseServer {
public st ......