易截截图软件、单文件、免安装、纯绿色、仅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");
     ......

java exception java异常汇总(1)

 java exception 解决方案 - 我的异常网|异常|exception 730 - org.hibernate.LazyInitializationException:could not initialize proxy 731 - 警告: Error setting value 732 - override and commit 733 - Building workspace has encountered a problem. Errors during build 734 - Could not open the editor: An ......

java配置环境变量

           unix系统:打开shell命令行
                输入vi _bash_profile 修改
                JA ......

java面试题及答案(基础题122道,代码题19道)

 JAVA相关基础知识
1、面向对象的特征有哪些方面
1.抽象:
抽象就是忽略一个主题中与当前目标无关的那些方面,以便更充分地注意与当前目标有关的方面。抽象并不打算了解全部问题,而只是选择其中的一部分,暂时不用部分细节。抽象包括两个方面,一是过程抽象,二是数据抽象。
2.继承:

承是一种联结类的层 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号