Measure the voltage to arduino?

Hi, is there a way to measure the voltage at the DC-inlet to the arduino? i am gonna power my Arduino UNO with 12v dc and it would be awesome if there is a way to see how much power there is left in the battery!

use a voltage divider to make e.g. 4Volt and measure this with analogRead().

schema: GND -- 10K --*-- 10K--10K --12V

measure analog near *