Simple picture says a thousand words
Note that a full circle is 360 degrees.
North is 000 degrees (or 360 degrees), East is pointed at a quarter to the right of that circle, so 090 degrees.
Between North and East is NE, so 090 divided by two is 045 degrees.
Between North and NE is NNE, so 045 divided by two is 22.5 degrees.
And there you have it, if you need to calculate which direction is NNE, ESE, WNW etc. just add or subtract 22.5 to NE, SE, NW etc.