In situ synthesis, magnetic property, and formation mechanism of Fe3O4 particles encapsulated in 1D bamboo-shaped carbon microtubes.