How to get the screen's size of a phone Android : <p>I want to get the size of the screen, I already have the resolution </p>

<pre><code> DisplayMetrics displayMetrics = new DisplayMetrics();
    WindowManager windowmanager = (WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
    windowmanager.getDefaultDisplay().getMetrics(displayMetrics);
    final int deviceWidth = displayMetrics.widthPixels;
    final int deviceHeight = displayMetrics.heightPixels;
</code></pre>

<p>but I want the size in inches, like the Samsung Galaxy S7 has a resolution of 2560x1440 and a screen of 5.1" , it's the 5.1 I want to get.</p>

<p>Thanks</p>
