Item repair

Item Repair was added in Beta 1.9 Pre-release 4 and allows players to repair damaged Tools or Items by combining them on a Crafting grid. Items can be placed anywhere on the crafting grid. The two weapons/tools the player is repairing must be of the same type and material for it to work. The health of the item that is repaired depends on the amount of health left in the two used items.

One could argue that this is useless, and really only serves to save space rather than renew valuable items, as most tools are used one at a time. However, combining expensive armors such as gold or diamond will greatly improve that armor's effectiveness. Additionally, when the player combines two tools, the product will have slightly more uses than the sum of the two original tools. Notch confirmed this mechanism on his twitter.

Algorithm
The general algorithm is currently unknown, but tests on pickaxes revealed completely linear behavior: the uses of the resulting item is the sum of previous uses (with the max durability cap), plus a number depending on the material: 2 for gold, 4 for wood, 12 for stone, 24 for iron, and 155 on diamond, being completely independent of the initial uses distribution (one almost new and other one almost broken, both half-broken, etc.), resulting in an improve about 6-10% in overall durability. Tests with other tools show the same results.