勾股数:a ^2 + b ^2=c ^2
求出1000以内的所有勾股数。
这里我们用两种方法,第一种是穷举法,相对耗时较多,第二种是简化了的穷举法,相比第一种耗时较少。
package _3InterestingInteger;
public class _3_6_1 {
public static void main(String[] args) {
long start=System.currentTimeMillis();
getNum(1000);
long end=System.currentTimeMillis();
//计算耗时
System.out.println("耗时:"+(end-start));
}