All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hotrod.utils.ColumnUtils Maven / Gradle / Ivy

The newest version!
package org.hotrod.utils;

public class ColumnUtils {

  public static long getMaxValue(final int digits) {
    if (digits < 1) {
      return 0;
    }
    if (digits > 18) {
      return Long.MAX_VALUE;
    }
    long value = 1;
    for (int i = 0; i < digits; i++) {
      value = value * 10;
    }
    return value - 1;
  }

  public static long getMinValue(final int digits) {
    if (digits > 18) {
      return Long.MIN_VALUE;
    }
    return -getMaxValue(digits);
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy