Here you can find the source of modArray(double value, int mod, int div)
Parameter | Description |
---|---|
value | a parameter |
mod | a parameter |
div | a parameter |
public static long[] modArray(double value, int mod, int div)
//package com.java2s; //License from project: LGPL public class Main { /**/* w ww . j a va2 s . c o m*/ * Return an array of long values. Length of array is "mod" value. * * @param value * @param mod * @param div * @return */ public static long[] modArray(double value, int mod, int div) { final long[] result = new long[mod]; if (result.length > 0) { result[0] = 100; if (result.length > 1) { final long base = ((long) (value / (mod * div))) * div; final long last = (long) (value - base * (mod - 1)); for (int i = 0; i < result.length; i++) { if (i == result.length - 1) { result[i] = last; } else { result[i] = base; } } } } return result; } }