Determine target API

Is there a way for an Android app to determine its target API level? (Particularly in the case of a JAR library, which cannot influence which apps it is embedded in, while app developers may not be …