public class Sample4 { public static void main(String[] args) { //int i; float j = 0; for (int i = 1; i <= 500; i++) { j = j + 1 / (float) i; } System.out.println("この計算結果は" + j + "です"); } }