Java examples for java.lang:Math Number
Iteratively gets the square of the sum of the numbers [num : 1]
//package com.java2s; public class Main { /**/*from w ww . j av a 2 s .c o m*/ * Iteratively gets the square of the sum of the numbers [num : 1] * * @param num Number to start at * @return The square of the sum */ public static long squareOfSum(long num) { long sum = 0; for (long i = num; i > 0; i--) { sum += i; } return (sum * sum); } }