All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jgroups.tests.bla4 Maven / Gradle / Ivy

There is a newer version: 9.1.7.Final
Show newest version
package org.jgroups.tests;

/**
 * @author Bela Ban
 * @since x.y
 */
public class bla4 {
    public static void main(String[] args) throws Exception {
        short s;

        s=toPositiveUnsignedShort(Short.MAX_VALUE+1);
        System.out.println("s = " + s);



    }

    protected static short toPositiveUnsignedShort(int num) {
        if(num < 0 || num > Short.MAX_VALUE) {
            short tmp=(short)num;
            throw new IllegalArgumentException(String.format("number %d must be a positive unsigned short", tmp));
        }
        return (short)num;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy