hasArray(): This method is available in java.nio.ByteBuffer class of Java.
Syntax:
boolean java.nio.ByteBuffer.hasArray()
This method tells whether or not this buffer is backed by an accessible byte array.
Parameters: NA
Returns: true if, and only if, this buffer is backed by an array and is not read-only.
Exceptions: NA
Approach
Java
import java.nio.ByteBuffer;public class ByteBufferhasArray {public static void main(String[] args) {byte array[] = { 1, 2, 3, 4 };ByteBuffer bb = ByteBuffer.wrap(array);System.out.println(bb.hasArray());}}
Output:
true
No comments:
Post a Comment