I've never seen this kind of problems - finding a function with almost no conditions which maximizes the integral - so I'm asking for a hint. The problem is as follows.
Find a continuous function $f:[0, 1]\to \mathbb R$ that maximizes $I(f)-J(f)$, where $$I(f)=\int_0^1 {x^2 f(x)dx},\ \ \ \ \ \ J(f)=\int_0^1{x\left(f(x)\right)^2 dx}$$
I tried to select candidates of types of functions that can possibly make the given integration maximum. Assuming that $f$ is a function that $\exists I(f), J(f)$, I considered a function $g(x):=xf(x)\{x-f(x)\}$, but still don't have a idea. Any helps will be very appreciated. Thanks.