Good day. How can I programmatically find out the device API version?

For example, if the API> 22 performs one action, and if less than 22 is another action?

    1 answer 1

    if (Build.VERSION.SDK_INT >= 22) else