Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for safeMultiply (0.05 sec)

  1. src/test/java/jcifs/util/ServerResponseValidatorTest.java

            assertEquals(20, validator.safeMultiply(4, 5));
            assertEquals(-20, validator.safeMultiply(-4, 5));
            assertEquals(0, validator.safeMultiply(0, 1000));
        }
    
        @Test
        public void testSafeMultiplyOverflow() throws Exception {
            assertThrows(SmbException.class, () -> {
                validator.safeMultiply(Integer.MAX_VALUE, 2);
            });
        }
    
        @Test
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Sat Aug 30 05:58:03 UTC 2025
    - 14.2K bytes
    - Viewed (0)
  2. src/test/java/jcifs/util/InputValidatorTest.java

        void testSafeMultiplication() {
            assertEquals(100, InputValidator.safeMultiply(10, 10));
            assertEquals(-100, InputValidator.safeMultiply(10, -10));
    
            assertThrows(ArithmeticException.class, () -> InputValidator.safeMultiply(Integer.MAX_VALUE, 2));
            assertThrows(ArithmeticException.class, () -> InputValidator.safeMultiply(Integer.MIN_VALUE, 2));
        }
    
        @Test
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Sat Aug 30 05:58:03 UTC 2025
    - 11.9K bytes
    - Viewed (0)
  3. src/main/java/jcifs/util/InputValidator.java

         *
         * @param a first operand
         * @param b second operand
         * @return product of a and b
         * @throws ArithmeticException if overflow occurs
         */
        public static int safeMultiply(int a, int b) {
            validateIntegerMultiplication(a, b, "Multiplication");
            return a * b;
        }
    
        /**
         * Validates SMB credits value
         *
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Sat Aug 30 05:58:03 UTC 2025
    - 13.5K bytes
    - Viewed (0)
  4. src/main/java/jcifs/util/ServerResponseValidator.java

         *
         * @param a first value
         * @param b second value
         * @return product
         * @throws SmbException if overflow would occur
         */
        public int safeMultiply(int a, int b) throws SmbException {
            totalValidations.incrementAndGet();
    
            long result = (long) a * (long) b;
            if (result > Integer.MAX_VALUE || result < Integer.MIN_VALUE) {
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Sat Aug 30 05:58:03 UTC 2025
    - 16.6K bytes
    - Viewed (0)
Back to top