All pastes #496904 Raw Edit

Untitled

public java v1 · immutable
#496904 ·published 2007-05-19 14:54 UTC
rendered paste body
import java.lang.Math;public class test1 {private final static int MAX=5000;public static void main(String args[]) {  double c, b;  int i = 0;  double a;  long start = System.currentTimeMillis();  for (c = 2; c <= MAX; c++) {    for (b = 1; b < c; b++) {      a = Math.sqrt(c*c - b*b);      if (Math.floor(a) == a) {        i++;      }    }  }  long end = System.currentTimeMillis();  System.out.println(i);  System.out.println("Time: " + (end - start));}}