Write a static method named problem² that receives a positive integer n as the argument and calculates the sum below by using a loop. Return the result.

Total = 1 x 2 + 2 x 3 + ... + n x (n-1)?