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.what is oracle.
2.what is major differenece oracle8i and oracle9i.
4.tell me some thing ur self.
5.please tell me about oops.
6.what is single inheritance.
7.what is multiple inheritance.
8.can java support multiple inheritance.
9.what is interface.
10.what is differenec between abstract c ......
FileDialog只能选择文件而不能选择文件夹。JFileChooser又太大,不太好看,鼓捣了好一会终于解决了。
记录一下关键部分代码,以备查用。
final JButton choose=new JButton("选择存储文件目录");
final JTextField dir=new JTextField();
final JFileChooser chooser=new JFileChooser();
chooser.setFileSe ......
/*
* EncryptUtils.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 2 of the License, or
* ......
/*
* 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 ......