how to get device id in android programmatically

how to get device id in android programmatically | how to find android device id |how to get device id in android studio java

 String android_id = Settings.Secure.getString(getApplicationContext().getContentResolver(),
                Settings.Secure.ANDROID_ID);
        Log.d("mydeviceid","id : " + android_id);