Java Long Number Create toLong(short[] arr)

Here you can find the source of toLong(short[] arr)

Description

Converts an array of short values to an array of long values.

License

Open Source License

Parameter

Parameter Description
arr a short array

Return

a long array

Declaration

public static long[] toLong(short[] arr) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/* www  . j a v a 2 s  .c  o  m*/
     * Converts an array of short values to an array of long values. Returns a
     * new array.
     *
     * @param   arr a short array
     * @return  a long array
     */
    public static long[] toLong(short[] arr) {
        int n = arr.length;
        long[] converted = new long[n];
        for (int i = 0; i < n; i++) {
            converted[i] = arr[i];
        }
        return converted;
    }

    /**
     * Converts an array of integer values to an array of long values. Returns a
     * new array.
     *
     * @param   arr an integer array
     * @return  a long array
     */
    public static long[] toLong(int[] arr) {
        int n = arr.length;
        long[] converted = new long[n];
        for (int i = 0; i < n; i++) {
            converted[i] = arr[i];
        }
        return converted;
    }
}

Related

  1. toLong(Object value)
  2. toLong(Object value)
  3. toLong(Object value)
  4. toLong(Object value, long defaultValue)
  5. toLong(Object x)
  6. toLong(String input, int radix, long defaultValue)
  7. toLong(String numeric)
  8. toLong(String param)
  9. toLong(String parameter)