易截截图软件、单文件、免安装、纯绿色、仅160KB

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使用rocksaw和vserv tcpip实现基于ICMP的Ping功能

一:准备 www.savarese.org download
 1.  rocksaw-1.0.0-src.tar.gz
 2.  vserv-tcpip-0.9.2-src.tar.gz
二:编译源文件得到jar包 使用Ant
 1.  build vserv-tcpip-0.9.2-src
      在vserv-tcpip-0.9.2目录下面建一个tests目录,然后在cmd窗口下进入 ......

java对mysql数据库的导入导出

//导出
String mysql="mysqldump -uroot -proot  --opt databasename > d:/test.sql";    
java.lang.Runtime.getRuntime().exec("cmd /c "+mysql);   
//导入
String mysql="mysqladmin -uroot -proot create databasename";    
java.lang.Runt ......

20个非常有用的Java程序片段

1. 字符串有整型的相互转换
  Java代码
  String a = String.valueOf(2);   //integer to numeric string
  int i = Integer.parseInt(a); //numeric string to an int
  2. 向文件末尾添加内容
  Java代码
  BufferedWriter out = null;
  try {
  out = new BufferedWriter(new FileWr ......

IBM Java 面试题

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 ......

年底收藏系列 Java安全工具,生成MD5,Base64,UUID


/*
* 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
* ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号