java.lang.Object
eu.hansolo.toolbox.Helper
-
Method Summary
Modifier and TypeMethodDescriptionstatic final booleanalmostEqual(double value1, double value2, double epsilon) static final booleanbiggerThan(double a, double b) static final StringbytesToHex(byte[] bytes) static final doubleclamp(double min, double max, double value) static final intclamp(int min, int max, int value) static final longclamp(long min, long max, long value) static final Instantstatic final LocalDatestatic final LocalDateTimeclamp(LocalDateTime min, LocalDateTime max, LocalDateTime value) static final <T extends Number>
Tclamp(T min, T max, T value) static final doubleclampMax(double max, double value) static final doubleclampMin(double min, double value) static final booleanequals(double a, double b) static final longgetCRC32Checksum(byte[] bytes) static final DateTimeFormattergetDateFormat(Locale locale) static final doublegetDecimalDeg(int degrees, int minutes, double seconds) static final intgetDegrees(double decDeg) static final doublegetDoubleFromText(String text) static final longgetEpochSecondsOfFirstDayOfWeek(int year, int weekNumber, Locale locale) static final longgetEpochSecondsOfLastDayOfWeek(int year, int weekNumber, Locale locale) static final LocalDategetFirstDayOfWeek(int year, int weekNumber, Locale locale) static final StringgetHexColorFromString(String text) static final intgetIntFromText(String text) static final <K,V extends Comparable<V>>
KgetKeyWithMaxValueInMap(Map<K, V> map) static final LocalDategetLastDayOfWeek(int year, int weekNumber, Locale locale) static final DateTimeFormattergetLocalizedDateFormat(Locale locale) static final <K,V extends Comparable<V>>
VgetMaxValueInMap(Map<K, V> map) static final StringgetMD5(byte[] bytes) static final Stringstatic final byte[]getMD5Bytes(byte[] bytes) static final StringgetMD5ForFile(File file) static final intgetMinutes(double decDeg) static final doublegetSeconds(double decDeg) static final StringgetSHA1(byte[] bytes) static final Stringstatic final byte[]getSHA1Bytes(byte[] bytes) static final StringgetSHA1ForFile(File file) static final StringgetSHA256(byte[] bytes) static final Stringstatic final byte[]getSHA256Bytes(byte[] bytes) static final StringgetSHA256ForFile(File file) static final StringgetSHA3_256(byte[] bytes) static final StringgetSHA3_256(String text) static final byte[]getSHA3_256Bytes(byte[] bytes) static final StringgetSHA3_256ForFile(File file) static final intgetWeekOfYear(long epochSeconds) static final intgetWeekOfYear(long epochSeconds, ZoneId zoneId) static final intgetWeekOfYear(Instant instant, ZoneId zoneId) static final intgetWeekOfYear(LocalDate date) static final intgetWeekOfYear(LocalDateTime dateTime) static final intgetWeekOfYear(ZonedDateTime zonedDateTime) static final intgetWeekOfYeear(Instant instant) static final booleanisPositiveInteger(String text) lastN(int n) static final booleanlessThan(double a, double b) static final Stringstatic final <T> Predicate<T>static StringreadFromInputStream(InputStream inputStream) static final StringreadTextFile(String filename) static final doubleround(double value, int precision) static final introundDoubleToInt(double value) static final doubleroundTo(double value, double target) static final doubleroundToHalf(double value) static final voidsaveTxtFile(String filename, String text) static final long[]secondsToHHMMSS(long seconds) static final StringsecondsToHHMMString(long seconds) static final StringshortenNumber(long value) static final StringshortenNumber(long value, Locale locale) static final StringtrimPrefix(String text, String prefix)
-
Method Details
-
clamp
-
clamp
public static final int clamp(int min, int max, int value) -
clamp
public static final long clamp(long min, long max, long value) -
clamp
public static final double clamp(double min, double max, double value) -
clamp
-
clamp
-
clamp
-
clampMin
public static final double clampMin(double min, double value) -
clampMax
public static final double clampMax(double max, double value) -
almostEqual
public static final boolean almostEqual(double value1, double value2, double epsilon) -
round
public static final double round(double value, int precision) -
roundTo
public static final double roundTo(double value, double target) -
roundToHalf
public static final double roundToHalf(double value) -
roundDoubleToInt
public static final int roundDoubleToInt(double value) -
equals
public static final boolean equals(double a, double b) -
biggerThan
public static final boolean biggerThan(double a, double b) -
lessThan
public static final boolean lessThan(double a, double b) -
isPositiveInteger
-
trimPrefix
-
getDateFormat
-
getLocalizedDateFormat
-
normalize
-
getDegrees
public static final int getDegrees(double decDeg) -
getMinutes
public static final int getMinutes(double decDeg) -
getSeconds
public static final double getSeconds(double decDeg) -
getDecimalDeg
public static final double getDecimalDeg(int degrees, int minutes, double seconds) -
not
-
lastN
-
getDoubleFromText
-
getIntFromText
-
getHexColorFromString
-
readFromInputStream
- Throws:
IOException
-
readTextFile
-
saveTxtFile
-
getFirstDayOfWeek
-
getEpochSecondsOfFirstDayOfWeek
-
getLastDayOfWeek
-
getEpochSecondsOfLastDayOfWeek
-
getWeekOfYear
-
getWeekOfYeear
-
getWeekOfYear
-
getWeekOfYear
-
getWeekOfYear
-
getWeekOfYear
public static final int getWeekOfYear(long epochSeconds) -
getWeekOfYear
-
shortenNumber
-
shortenNumber
-
getMaxValueInMap
-
getKeyWithMaxValueInMap
-
secondsToHHMMString
-
secondsToHHMMSS
public static final long[] secondsToHHMMSS(long seconds) -
getCRC32Checksum
public static final long getCRC32Checksum(byte[] bytes) -
getMD5
-
getMD5
-
getMD5Bytes
public static final byte[] getMD5Bytes(byte[] bytes) -
getMD5ForFile
- Throws:
Exception
-
getSHA1
-
getSHA1
-
getSHA1Bytes
public static final byte[] getSHA1Bytes(byte[] bytes) -
getSHA1ForFile
- Throws:
Exception
-
getSHA256
-
getSHA256
-
getSHA256Bytes
public static final byte[] getSHA256Bytes(byte[] bytes) -
getSHA256ForFile
- Throws:
Exception
-
getSHA3_256
-
getSHA3_256
-
getSHA3_256Bytes
public static final byte[] getSHA3_256Bytes(byte[] bytes) -
getSHA3_256ForFile
- Throws:
Exception
-
bytesToHex
-