Here you can find the source of copySignedIntToShortArray(int[] src)
Copy an array of signed values in int, into an array of short.
The value is truncated as necessary.
Parameter | Description |
---|---|
src | an array of int |
static public short[] copySignedIntToShortArray(int[] src)
//package com.java2s; public class Main { /**//from w ww .j a v a2s.co m * <p>Copy an array of signed values in int, into an array of short.</p> * * <p>The value is truncated as necessary.</p> * * @param src an array of int * @return an array of short */ static public short[] copySignedIntToShortArray(int[] src) { if (src == null) return null; int n = src.length; short[] dst = new short[n]; for (int j = 0; j < n; ++j) { dst[j] = (short) (src[j]); // truncates } return dst; } }