3. Given that $a$, $b$, $c$, $d$ are the thousands, hundreds, tens, and units digits of a four-digit number, respectively, and the digits in lower positions are not less than those in higher positions. When $|a-b|+|b-c|+|c-d|+|d-a|$ takes the maximum value, the maximum value of this four-digit number is $\qquad$ .
$$
\begin{array}{l}
\text { 3. } 1999 . \\
\because a \leqslant b \leqslant c \leqslant d, \\
\therefore a-b \leqslant 0, b-c \leqslant 0, c-d \leqslant 0, d-a \geqslant 0 . \\
\therefore|a-b|+|b-c|+|c-d|+|d-a| \\
=b-a+c-b+d-c+d-a \\
=2(d-a) .
\end{array}
$$

When $d=9, a=1$,
$$
|a-b|+|b-c|+|c-d|+|d-a|
$$

has a maximum value of 16. At this time, $b$ and $c$ can be any numbers.
Therefore, the maximum value of this four-digit number is 1999.
$$