Java Assert assertHexOrDecLongValue(String value)

Here you can find the source of assertHexOrDecLongValue(String value)

Description

assert Hex Or Dec Long Value

License

Open Source License

Declaration

public static boolean assertHexOrDecLongValue(String value) 

Method Source Code

//package com.java2s;

public class Main {
    public static boolean assertHexOrDecLongValue(String value) {
        try {/*from  w w w  . j  av a 2  s .c o  m*/
            parseHexOrDecLong(value);
        } catch (NumberFormatException nfe) {
            return false;
        }
        return true;
    }

    public static Long parseHexOrDecLong(String value) {
        return value.startsWith("0x") ? Long.parseLong(value.substring(2), 16) : Long.parseLong(value, 10);
    }
}

Related

  1. assertGreaterOrEqualsThan(final long value, final long limit, final String name)
  2. assertGreaterThanOrEquals(String name, double comparedTo, double number)
  3. assertHasInterface(Class interfaceClass, Class objectClass)
  4. assertHasLength(String... params)
  5. assertHasText(String str)
  6. assertInBounds(final String param, final int value, final int min, final int max)
  7. assertInBounds(int[] coordinates)
  8. assertIndex(final int size, final int index)
  9. assertIndex(final String s, final int index)