Primitive type decimal in Java - User Entry
<p>I am doing an exercise in which the user has to input a signed four digit decimal number such as <code>+3364</code>, <code>-1293</code>, <code>+0007</code>, etc using Java programming language.</p>

<p>As far as I know, Java does not support a primitive type decimal.<br>
My questions are:</p>

<ol>
<li>how can enter numbers like the above?</li>
<li>how can I provide a +, - sign for the above numbers?</li>
</ol>

<p>UPDATE
 The code below shows a snippet in which it asks the user to enter a valid number (no characters) - the unary + is not working using the code below!! is there a way to fix it.</p>

<pre><code> public int readInt()
        {
            boolean continueLoop = true;
            int number = 0;
            do 
            {
                try
                {
                    number = input.nextInt();
                    continueLoop = false;
                }// end try

                catch (InputMismatchException inputMismatchException) 
                {
                    input.nextLine();
                    /** discard input so user can try again */
                    System.out.printf("Invalid Entry ?: ");
                }// end of catch

            } while (continueLoop); // end of do...while loop

            return number;
        }// end of method readInt()
</code></pre>
