Here you can find the source of getShortBuffer(short[] list)
Parameter | Description |
---|---|
lista | de shorts |
public static ShortBuffer getShortBuffer(short[] list)
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.ShortBuffer; public class Main { /**/*from w w w . jav a 2 s . com*/ * Produce un ShortBuffer a partir de una lista de shorts * @param lista de shorts * @return ShortBuffer resultante */ public static ShortBuffer getShortBuffer(short[] list) { ByteBuffer bb = ByteBuffer.allocateDirect(list.length * Short.SIZE / 8); bb.order(ByteOrder.nativeOrder()); ShortBuffer sb = bb.asShortBuffer(); sb.put(list); sb.position(0); return sb; } }