Minecraft wiki entry for Development_versions, associated text: Double-click items to fill the stack up as much as possible.
Drag item stacks around to divide them up over the dragged-over slots.
Drag item stacks around with the right mouse button to place one of that stack in each dragged-over slot, if that slot is not occupied already.
Shift double-click an item stack to move all other item stacks of that kind to that part of the inventory.
Press Q while the mouse is over an item in the inventory or a container to drop it.