Minecraft wiki entry for Before_14w02a, associated text: Total Experience = 17[Level] (at levels 0-15)
1.5[Level]2 - 29.5[Level] + 360 (at levels 16-30)
3.5[Level]2 - 151.5[Level] + 2220 (at level 31+)
This equation does not include any experience that is currently filling the experience bar.
Additionally, the amount of experience required to advance to the next level can be calculated using the equations:
Experience Required = 17 (at levels 0-14)
3[Current Level] -28 (at levels 15-29)
7[Current Level] - 148 (at level 30+)