i got a little bit of problem with my coding for finding the total sum..

the formula given to me is 1^k+2^k+...+n^k.
my coding as follows:
  public int sumPowTo (int n, int k)
  {
 
     if ( k == 0)
    {
      return 1;
    }
    else if ( k == 1)
    {
      return n;
    }
 
    else 
    {
      return  (n * sumPowTo(n,--k)) + (sumPowTo(n--,--k)) ;
    }
  }
it just doesnt add up to the right amout.

for example int sumPowTo(4,2) = 30
but i get 28