How to determine if an app is running on Android M (Developer Preview)

Note: this question was asked for the Android M developer preview, not the official Android 6.0.

android.os.Build.VERSION.SDK_INT returns 22 on Android M (22 is the api level for LOLLIPOP_MR1). How are we supposed to check whether the app runs on Android M? I had something like this in mind but that obviously doesn't work: