Justin Bieber has taken to Twitter to apologise for telling a racist joke after The Sun obtained footage of the singer using racially offensive language.