The economy of South Africa is the second-largest in Africa, behind Nigeria. South Africa accounts for 24 percent of Africa's gross domestic product (PPP), and it is ranked as an upper-middle-income economy by the World Bank. South Africa's Gross Domestic Product has almost tripled to $400 billion, and foreign exchange reserves have increased from $3 billion to nearly $50 billion; creating a diversified economy with a growing and sizable middle class, within two decades of establishing democracy and ending apartheid.