Java ByteBuffer Allocate allocate(int length, byte fillwith)

Here you can find the source of allocate(int length, byte fillwith)

Description

allocate

License

Open Source License

Declaration

public static ByteBuffer allocate(int length, byte fillwith) 

Method Source Code

//package com.java2s;
/* Copyright 2004 - 2007 Kasper Nielsen <kasper@codehaus.org> Licensed under 
 * the Apache 2.0 License, see http://coconut.codehaus.org/license.
 *//*from   w  w  w .ja  v  a 2 s.  c  o m*/

import java.nio.ByteBuffer;

public class Main {
    public static ByteBuffer allocate(int length, byte fillwith) {
        byte[] bytes = new byte[length];
        for (int i = 0; i < length; i++)
            bytes[i] = fillwith;
        return ByteBuffer.wrap(bytes);
    }
}

Related

  1. allocate(int capacity)
  2. allocate(int capacity, boolean direct)
  3. allocate(int length)
  4. allocate(int size)
  5. allocate(int size)
  6. allocateBuffer(int size, boolean isDirect)
  7. allocateDirect(int capacity)