Example usage for java.lang Math floor

List of usage examples for java.lang Math floor

Introduction

In this page you can find the example usage for java.lang Math floor.

Prototype

public static double floor(double a) 

Source Link

Document

Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer.

Usage

From source file:co.turnus.analysis.util.AnalysisUtil.java

public static int[] linspacei(int min, int max, int points) {
    Set<Integer> values = new LinkedHashSet<Integer>();
    values.add(min);//  w  w w . ja v  a 2 s  .c  o  m
    for (double d : linspaced(min, max, points)) {
        values.add((int) Math.floor(d));
    }
    values.add(max);
    return ArrayUtils.toPrimitive(values.toArray(new Integer[0]));
}

From source file:org.apache.usergrid.chop.runner.drivers.TimeTracker.java

@Override
public int getPercentCompleted() {
    double percent = (double) getActualTime() / (double) timeChop.time();
    return (int) Math.floor(percent);
}

From source file:us.putney.controllers.SampleServiceController.java

static Map getHero(String name) {
    Map<String, Object> hero = new HashMap<String, Object>();
    hero.put("name", name);
    hero.put("title", titles[(int) Math.floor(Math.random() * titles.length)]);
    hero.put("age", (int) (Math.random() * 100));
    List powers = new ArrayList();
    for (int i = 0; i < 1 + Math.random() * 3; i++) {
        powers.add(getPower());// ww w  . j  av  a2  s . com
    }
    hero.put("powers", powers);
    return hero;
}

From source file:me.whitmarbut.mfa.TOTP.java

private int getTimestamp() {
    return (int) Math.floor((System.currentTimeMillis() / 1000) / 30);
}

From source file:fr.samar.StoryboardItem.java

public StoryboardItem(DocumentModel doc, String basePropertyPath, int position, String baseURL) {
    this.doc = doc;
    this.position = position;
    String propertyPath = basePropertyPath + "/" + position;
    blobPropertyName = propertyPath + "/content";
    filename = String.format("storyboard-%03d.jpeg", position);
    try {//from w  ww .  jav a  2s.c o  m
        Double tc = doc.getProperty(propertyPath + "/timecode").getValue(Double.class);
        if (tc != null) {
            startTimecode = String.format("%f", Math.floor(tc));
        }
        // TODO: read filename from blob too
    } catch (Exception e) {
        log.warn(e);
    }
    url = URLHelper.bigFileUrl(doc, baseURL, blobPropertyName, filename);
}

From source file:org.apache.usergrid.chop.runner.drivers.IterationTracker.java

@Override
public int getPercentCompleted() {
    double percent = (double) getActualIterations() / (double) iterationChop.iterations();
    return (int) Math.floor(percent);
}

From source file:edu.illinois.cs.cogcomp.wikifier.utils.datastructure.StringMap.java

public StringMap(int capacity) {
    super(stringHashStrat, (int) Math.floor(capacity / DEFAULT_LOAD_FACTOR), DEFAULT_LOAD_FACTOR);
}

From source file:IK.G.java

public static double floor(double in) {
    return Math.floor(in);
}

From source file:es.udc.gii.common.eaf.benchmark.multiobjective.wfg.Wfg_Objective.java

protected double s_linear(double y, double A) {
    return correct_to_01(Math.abs(y - A) / Math.abs(Math.floor(A - y) + A), EPSILON);
}

From source file:emlab.trend.StepTrend.java

public double getValue(long time) {
    return Math.max(minValue, getStart() + Math.floor(time / duration) * increment);
}