Java Integer Array Create intArray(double a, double b, double c)

Here you can find the source of intArray(double a, double b, double c)

Description

Helper method to avoid lots of explicit casts in getShape().

License

LGPL

Parameter

Parameter Description
a x
b y
c z

Return

int[3] with converted params.

Declaration

static int[] intArray(double a, double b, double c) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    /**//from  w  ww  .j  a v  a  2 s . co  m
     * Helper method to avoid lots of explicit casts in getShape().  Returns
     * an array containing the provided doubles cast to ints.
     *
     * @param a  x
     * @param b  y
     * @param c  z
     *
     * @return int[3] with converted params.
     */
    static int[] intArray(double a, double b, double c) {
        return new int[] { (int) a, (int) b, (int) c };
    }

    /**
     * Helper method to avoid lots of explicit casts in getShape().  Returns
     * an array containing the provided doubles cast to ints.
     *
     * @param a  x
     * @param b  y
     * @param c  z
     * @param d  t
     *
     * @return int[4] with converted params.
     */
    static int[] intArray(double a, double b, double c, double d) {
        return new int[] { (int) a, (int) b, (int) c, (int) d };
    }
}

Related

  1. intArray(int len)
  2. intArray(Integer... values)
  3. intArray(String data)
  4. intArrayConcat(int[] a, int[] b)