Java - slice methods: set buffer limit to its capacity before change its position