java.lang.Object
eu.hansolo.toolbox.Helper
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final record -
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 doublecalcBearingInDegree(double latitude1, double longitude1, double latitude2, double longitude2) static final doublecalcBearingInDegree(GeoLocation location1, GeoLocation location2) static final doublecalcDistanceInMeter(double latitude1, double longitude1, double latitude2, double longitude2) static final doublecalcDistanceInMeter(GeoLocation location1, GeoLocation location2) 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 Constants.Architecturestatic final Constants.ArchitecturegetArchitecture(Constants.OperatingSystem operatingSystem) static final CardinalDirectiongetCardinalDirectionFromBearing(double brng) static final Helper.ClassLoadingInfostatic final Helper.CompilationInfostatic 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 longstatic final Helper.HeapInfostatic final StringgetHexColorFromString(String text) static final intgetIntFromText(String text) static final Helper.JvmInfostatic 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 intstatic final longstatic 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 Helper.MemInfostatic final intgetMinutes(double decDeg) static final Constants.OperatingModestatic final Constants.OperatingModegetOperatingMode(Constants.OperatingSystem operatingSystem) static final Constants.OperatingSystemstatic final Helper.OperatingSystemInfostatic final intstatic final List<Helper.RootInfo>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 Helper.SystemSummarystatic final longstatic 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 final Stringstatic final Stringstatic final StringreadFromInputStream(InputStream inputStream) static final StringreadTextFileToString(File file) static final StringreadTextFileToString(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 voidsaveStringToTextFile(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
-
readTextFileToString
-
readTextFileToString
-
saveStringToTextFile
-
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
-
nonEmpty
-
padLeft
-
padRight
-
getPhysicalCores
public static final int getPhysicalCores() -
getLogicalCores
public static final int getLogicalCores() -
getTotalMemory
public static final long getTotalMemory() -
getMaxMemory
public static final long getMaxMemory() -
getFreeMemory
public static final long getFreeMemory() -
getArchitecture
-
getArchitecture
public static final Constants.Architecture getArchitecture(Constants.OperatingSystem operatingSystem) -
getOperatingSystem
-
getOperatingMode
-
getOperatingMode
public static final Constants.OperatingMode getOperatingMode(Constants.OperatingSystem operatingSystem) -
getOperatingSystemInfo
-
getJvmInfo
-
getCompilationInfo
-
getClassLoadingInfo
-
getHeapInfo
-
getMemInfo
-
getRootInfos
-
getSystemSummary
-
calcDistanceInMeter
-
calcDistanceInMeter
public static final double calcDistanceInMeter(double latitude1, double longitude1, double latitude2, double longitude2) -
calcBearingInDegree
-
calcBearingInDegree
public static final double calcBearingInDegree(double latitude1, double longitude1, double latitude2, double longitude2) -
getCardinalDirectionFromBearing
-