Pixel size or dpi

Different devices have different screen density (pixel size, dpi).

How to detect it in runtime for use in Dc methods?