public static COSNumber get( String number ) throws IOException
    {
        if (number.length() == 1)
        {
            char digit = number.charAt(0);
            if ('0' <= digit && digit <= '9') 
            {
                return COSInteger.get((long) digit - '0');
            } 
            if (digit == '-' || digit == '.')
            {
                // See https://issues.apache.org/jira/browse/PDFBOX-592
                return COSInteger.ZERO;
            } 
            throw new IOException("Not a number: " + number);
        } 
        if (isFloat(number))
        {
            return new COSFloat(number);
        }
        try
        {
            return COSInteger.get(Long.parseLong(number));
        }
        catch (NumberFormatException e)
        {
            // check if the given string could be a number at all
            String numberString = number.startsWith("+") || number.startsWith("-")
                    ? number.substring(1) : number;
            if (!numberString.matches("[0-9]*"))
            {
                throw new IOException("Not a number: " + number);
            }
            // return a limited COSInteger value which is marked as invalid
            return number.startsWith("-") ? COSInteger.OUT_OF_RANGE_MIN
                    : COSInteger.OUT_OF_RANGE_MAX;
        }
    }
@Test
    void testGet()
    {
        try
        {
            
            // Ensure the basic static numbers are recognized
            assertEquals(COSInteger.ZERO, COSNumber.get("0"));
            assertEquals(COSInteger.ZERO, COSNumber.get("-"));
            assertEquals(COSInteger.ZERO, COSNumber.get("."));
            assertEquals(COSInteger.ONE, COSNumber.get("1"));
            assertEquals(COSInteger.TWO, COSNumber.get("2"));
            assertEquals(COSInteger.THREE, COSNumber.get("3"));
            // Test some arbitrary ints
            assertEquals(COSInteger.get(100), COSNumber.get("100"));
            assertEquals(COSInteger.get(256), COSNumber.get("256"));
            assertEquals(COSInteger.get(-1000), COSNumber.get("-1000"));
            assertEquals(COSInteger.get(2000), COSNumber.get("+2000"));
            // Some arbitrary floats
            assertEquals(new COSFloat(1.1f), COSNumber.get("1.1"));
            assertEquals(new COSFloat(100f), COSNumber.get("100.0"));
            assertEquals(new COSFloat(-100.001f), COSNumber.get("-100.001"));
            // according to the specs the exponential shall not be used
            // but obviously there some
            assertNotNull(COSNumber.get("-2e-006"));
            assertNotNull(COSNumber.get("-8e+05"));

            assertThrows(NullPointerException.class, () -> COSNumber.get(null));
            assertThrows(IOException.class, () -> COSNumber.get("a"));
        }
        catch (IOException e)
        {
            fail("Failed to convert a number " + e.getMessage());
        }
    }