DPI by itself is completely meaningless in digital photography. Suppose you have a camera that takes an image that measures 4000 x 6000 pixels. Regardless of whether the DPI is 240, 300, 600, or whatever, the image is still 4000 x 6000 pixels. Changing the DPI setting by itself, and doing nothing else as far as size is concerned will have literally no effect on the quality of your image.
It is much more important to understand how to determine how large of a print you want to create. If you want to create the largest print you can from the aforementioned print size at 300 PPI (not really DPI) then you need to understand the calculations:
4000 pixels / 300 PPI = 13.3333 inches
6000 pixels / 300 PPI = 20 inches
So if you have an image with that many pixels and you want it printed at 300 PPI then you will have a print that is 13 x 20". And it doesn't matter what the PPI setting is. That setting does not change anything as far as size or quality is concerned.