I'd like to give Joe Pardue of Smiley Micros credit for me learning this, if you want a quick, dirty, and efficient way to input on your ADC with less jitter, do a bit shifting 3 bit trick as follows:

int thisval;

int total=0;

for ( int x=0; x<8; x++) //Inputs the value from pin (now variable a) in a for loop.

{

total += analogRead(xpin); //Compound addition operation

} //Equivalent to total = total + AnalogInput

thisval = total >> 3; //Averages the eight values the for loop added via bit shifting to smooth out sensor noise/inaccuracy, and thus also helps with digital debouncing. (false

//triggering if value is a level threshold measurement)

// There are a couple tricks here, first +=, which you can study on compound addition in the reference section, second, and less easy to grasp, is what's happening with: total >>3;

// Like I said before, here's where the savings starts. You get to do an average without doing floating point math. You shift the sum of eight numbers 3 bits over and you'll pretty much //end up with the average of the eight and bit shifting is easier on a microprocessor than floating point math. These efficiency savings add up, even though my program worked fine while I //was doing an average of three numbers.