Java数字转字符串前面自动补0的实现
本文原址:http://blogger.org.cn/blog/more.asp?name=hongrui&id=46926
/**
* Java里数字转字符串前面自动补0的实现。
*
*/
public class TestStringFormat {
public static void main(String[] args) {
int youNumber = 19;
// 0 代表前面补充0
// 4 代表长度为4
// d 代表参数为正数型
String str = String.format("%02d", youNumber);
System.out.println(str); // 01
}
}
相关文档:
Java NIO API详解
在JDK
1.4以前,Java的IO操作集中在java.io这个包中,是基于流的阻塞(blocking)API。对于大多数应用来说,这样的API使用很方
便,然而,一些对性能要求较高的应用,尤其是服务端应用,往往需要一个更为有效的方式来处理IO。从JDK 1.4起,NIO
API作为一个基于缓冲区,并能提供非阻塞(non-blo ......
1.用new String(request.getParameter("name").getBytes("ISO-8859-1"),"GBK") 方式进行转码
2.设置tomcat:在tomcat的conf目录下找到server.xml文件,在Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
......
/*
* CookieSupport.java
* Copyright (C) 2007-3-19 <JustinLei@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version ......
1、将项目打包好;
2、将JRE目压缩成JRE.rar,放在当前项目目录下;
2、下载GreenJVM,其中两个主要文件(GreenJVM.exe和vm.cfg)
3、用计事本打开vm.cfg设置参数,参数很多,只要设置下面几个就可以用了:
SET_VM_NAME=jre.rar
SET_START_JAR_PATH=***.jar &nbs ......