Former Brazil and Inter Milan goalkeeper Julio Cesar has retired from football after playing his last match for boyhood club Flamengo.