Add a newer math helper
This commit is contained in:
parent
3d50d8f4ec
commit
c34294c48c
3 changed files with 20 additions and 0 deletions
18
src/main/java/dev/zontreck/ariaslib/util/MathUtil.java
Normal file
18
src/main/java/dev/zontreck/ariaslib/util/MathUtil.java
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
package dev.zontreck.ariaslib.util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class will be used to house math helper functions
|
||||||
|
*/
|
||||||
|
public class MathUtil
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A newer helper function to get the percentage with large number support
|
||||||
|
* @param current Min value
|
||||||
|
* @param max Maximum value for progress
|
||||||
|
* @return Percentage
|
||||||
|
*/
|
||||||
|
public static int getPercent(long current, long max)
|
||||||
|
{
|
||||||
|
return Math.round(current*100/max);
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package dev.zontreck.ariaslib.util;
|
||||||
|
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public class Percent
|
public class Percent
|
||||||
{
|
{
|
||||||
int current;
|
int current;
|
||||||
|
|
|
@ -2,6 +2,7 @@ package dev.zontreck.ariaslib.util;
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public class Progress
|
public class Progress
|
||||||
{
|
{
|
||||||
private int maximum;
|
private int maximum;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue