How to measure the voltage of battery using Arduino built-in voltmeter?

I want to simply measure the voltage of a AA battery using Arduino Uno, but I don't know how to hook up the wires to do so. Do I need to connect the negative terminal from the battery to GND pin of the Arduino Uno? Do I need to use 5V or 3.3V pin of the Arduino Uno? Any advice would be helpful. Thanks in advance!

You need to connect indeed the negative terminal to GND.
Then you take 2 resistors of 10K in series and you connect these between the GND and the positive terminal.
That is a voltage divider (google for a picture)
Now you can measure with analogRead() between the two resistors and you should see half the voltage of the battery. The resistors prevent a big current that can damage your duino.

Thanks! It worked!!

If you have e.g. a 24 Volt power source you should make a voltage divider that does not divide 1:1 but 1:

e.g. +24 --- 50K ---*---- 10K ---GND (total 60K) so after measuring at the star you get 10/60 * 24 ~4Volt.

i measured the voltage of the arduino using analogread(),and connected pull down resistors ,,,but i cant measure the voltage of an external battery ??do i any more code correction or any circuit ??help me!!

raghul_emcee, post your code.
You should be able to connect a battery with less than 5V direct to an analog input (battery +) and Gnd (battery -) on a 5V powered Arduino and get a reading from 0 to 1023:

void setup(){
Serial.begin(9600);
}
void loop(){
Serial.println(analogRead(A0));
delay(1000);
}