Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.CharBuffer;

public class Main {
    /**
     * @param size number of chars the buffer should hold
     * @return the newly allocated char buffer
     */
    public static CharBuffer createCharBuffer(int size) {
        ByteBuffer bb = ByteBuffer.allocateDirect(2 * size);
        bb.order(ByteOrder.nativeOrder());
        return bb.asCharBuffer();
    }
}