Hyphens are used in numbers to separate words when they are used as adjectives before a noun. For example:
* two-thousand-eighty-seven-page book
* a two-thousand-eighty-seven-mile journey
However, when the number stands alone, it is written as "two thousand eighty seven."