So I'm creating a program that calculates the “Sum of Powers” after the user inputs two integers N and M. The sum of powers is computed as N^M+ N^(M-1)+ N^(M-2)….+N^0.

But I don't know how to finish it. I'm kinda confused using return method, loops, etc.

Here's what I have so far:

```
import java.util.Scanner;
public class SumOfPow
{
public static int exponent(int n,int m)
{
int nProd = 1;
// COMPLETE THE CODE THAT MAKES THE FUNCTION RETURN n^m
return nProd;
}
public static void main(String args[])
{
int N, M;
int Power = 0;
// Complete the code with the necessary statements. Make use of the method “exponent”
System.out.println ("Sum of Powers: "+Power);
}
```

I know what I'm supposed to do, but I can't code it. I got the logic down, but I don't know how to code it.