Understanding Digital IMU 6DOF sketch
The writeTo functions

The accelerometer and gyro both have some memory inside that is used to store the configuration. The specific locations and values can be read from the datasheet, but for now I'll trust the comments. These writeTo functions seem to set the device modes and configure the scale used for the sensors. 

Notice that they only happen once, right when the program starts. Maybe the devices have a way of storing persistent settings onboard, but setting them once at each startup is safe and easy.

The Bitwise ops

These don't set the number of bits we are reading per se, They reconstruct larger than 8-bit values. The I2C serial protocol is set up to use 8-bit data segments, so to send any value larger than 8-bits they must be broken down, sent, and then "stitched" back together in chucks.

(((int)buffer[0]) &lt;&lt; 8 ) | buffer[1];

Whats happening here is that buffer[0] is converted to int (a 16 bit value), then shifted over by 8 bits. This means the 8 bits in the original buffer[0] are now located in the top 8-bits of the integer, and the lower 8 bits are zeros. Finally the lower 8 bits are set by the bitwise-or operator |, which will turn on any bits that were set in buffer[1] in the result. Since the bottom 8-bits were 0's from the shift, this just copies buffer[1] in exactly.

The net effect is a 16 bit value that contains the bits of both 8-bit buffer values and can be interpreted as a single number.