The German economy grew a better-than-expected 0.4 percent in the second quarter of 2016, according to flash estimates.