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

java 找出4位数的所有吸血鬼数字

 /**
* 找出四位数所有的吸血鬼数字
* 吸血鬼数字:位数为偶数的数字可以由一对数字相乘而得,这对数字包含乘积一半的位数
* 如:1260 = 21*60
*/
public class Vampire {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

String s="";
for(int i=1; i<10; i++){
for(int j=0; j<10; j++){
s += (10*i+j)+" ";
}
}
System.out.println(s);

String[] arr = s.split(" ");
System.out.println("两位数的个数为:"+arr.length);

int a,b;
int count=0;
for(int j=0; j<arr.length; j++){
for(int k=0; k<arr.length; k++){
a = Integer.valueOf(arr[j]).intValue();
b = Integer.valueOf(arr[k]).intValue();
//为能以两个0结尾
if(a*b<10000 && a*b>1000 && (a*b)%100!=0){
count++;
System.out.print(arr[j]+"_"+arr[k]+" ");
}
}
System.out.println();
}
System.out.println("the total number is "+count); //6370

}



相关文档:

JAVA静态块和非静态块的区别

 
//静态块(static block):如下所示
public class StaticBlock1
{
       static
       {
              System.out.println("static block");
     ......

Some Java based open


Database
MySQL
PostgreSQL
Firebird(suitable for embedded database)
HSQLDB(160K)
DB Tie
Hibernate
Ibatis
JDO
OSCache
JBossCache
Business Tie
Spring
UI Tie
Structs
JSF
Tapestry
Webwork
Flex
DWR(Ajax
Framework)
ZK(Ajax
Framework)
Dojo(Ajax
Framework)
Development Tools
......

Java 解压rar文件的经典实例

2009-11-11  18:06:09
/**
*
* @author Ice*
*/
public class RarUtil{
public static void main(String args[]) throws Exception {

String compress = "D:\\test.rar";// rar压缩文件
String decompression = "D:\\";// 解压路径
unZip(compress, decompression);

}
/** ......

java 找出100以内的素数

 public class FindPrime {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int num = 100;
String s = "100以内的素数:";
for (int i = 1; i <= num; i++) {
int count = 0;
for (int j = 1; j <= (int) Math.s ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号