Java ByteBuffer to Short Array getShortNumeric(java.nio.ByteBuffer buffer, int len)

Here you can find the source of getShortNumeric(java.nio.ByteBuffer buffer, int len)

Description

get Short Numeric

License

Open Source License

Declaration

public static short getShortNumeric(java.nio.ByteBuffer buffer, int len) 

Method Source Code

//package com.java2s;

public class Main {
    public static short getShortNumeric(java.nio.ByteBuffer buffer, int len) {
        String s = "";
        if (null != buffer && buffer.remaining() >= len) {
            byte[] dest = new byte[len];
            buffer.get(dest, 0, len);//  www . j  ava 2  s  .com
            s = new String(dest);
        }
        return (short) (0xFFFF & Integer.parseInt(s));
    }
}

Related

  1. getShortB(ByteBuffer bb, int bi)
  2. getShortBE(ByteBuffer b, int start, int end)
  3. getShortBE(final ByteBuffer b, final int start, final int end)
  4. getShortLength(ByteBuffer bb)
  5. getShortLength(ByteBuffer bb, int position)
  6. getShortString(ByteBuffer in)