public static IntBuffer allocate ( int capacity ) { if ( capacity < 0 ) { throw new IllegalArgumentException ( ) ; } ByteBuffer bb = ByteBuffer . allocateDirect ( capacity * 4 ) ; bb . order ( ByteOrder . nativeOrder ( ) ) ; return bb . asIntBuffer ( ) ; }
Creates an int buffer based on a newly allocated int array .