It is easy to find out the form of F(k) - F(0):

F(k) - F(0) = k * Sum(i for i in A) - n * (A[n-k] + A[n-k+1] + ... + A[n-1]),

where n is the length of A. Thus we do not need to use extra arrays to implement this project. However, the first time I used int-type variables, but I got errors. Then I instead used long-type variables and it worked out fine. Here is the code.

```
public class Solution {
public int maxRotateFunction(int[] A)
{
long a = 0, b = 0, res = 0, t = 0, f0 = 0;
int n = A.length;
for (int i = 0; i < n; i++)
{
a += A[i];
f0 += i * A[i];
}
for (int k = 1; k < n; k++)
{
b += A[n - k];
t = k * a - n * b;
res = t > res ? t : res;
}
return (int)(f0 + res);
}
```