public static int compose ( final int major , final int minor , final int patch ) { if ( major < 0 || major > 255 ) { throw new IllegalArgumentException ( "major must be 0-255: " + major ) ; } if ( minor < 0 || minor > 255 ) { throw new IllegalArgumentException ( "minor must be 0-255: " + minor ) ; } if ( patch < 0 || patch > 255 ) { throw new IllegalArgumentException ( "patch must be 0-255: " + patch ) ; } if ( major + minor + patch == 0 ) { throw new IllegalArgumentException ( "all parts cannot be zero" ) ; } return ( major << 16 ) | ( minor << 8 ) | patch ; }
Compose a 4 - byte integer with major minor and patch version stored in the least significant 3 bytes . The sum of the components must be greater than zero .