Here you can find the source of roundMonthUnits(final int defaultUnitValue)
Parameter | Description |
---|---|
defaultUnitValue | a parameter |
public static int roundMonthUnits(final int defaultUnitValue)
//package com.java2s; /******************************************************************************* * Copyright (C) 2005, 2016 Wolfgang Schramm and Contributors * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation version 2 of the License./* w w w . j a v a 2 s .c o m*/ * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA *******************************************************************************/ public class Main { /** * Round number of units to a 'month suitable' format. * * @param defaultUnitValue * @return */ public static int roundMonthUnits(final int defaultUnitValue) { float unit = defaultUnitValue; while (unit > 144) { unit /= 12; } unit = // // unit >= 12 ? 12 : // unit >= 6 ? 6 : // unit >= 4 ? 4 : // unit >= 3 ? 3 : // unit >= 2 ? 2 : // 1; return (int) unit; } }