Java Code Examples for com.google.common.math.LongMath#mod()

The following examples show how to use com.google.common.math.LongMath#mod() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MathUtil.java    From vjtools with Apache License 2.0 4 votes vote down vote up
/**
 * 保证结果为正数的取模
 */
public static int mod(long x, int m) {
	return LongMath.mod(x, m);
}
 
Example 2
Source File: MathUtil.java    From vjtools with Apache License 2.0 4 votes vote down vote up
/**
 * 保证结果为正数的取模
 */
public static int mod(long x, int m) {
	return LongMath.mod(x, m);
}
 
Example 3
Source File: MathUtil.java    From j360-dubbo-app-all with Apache License 2.0 4 votes vote down vote up
/**
 * 保证结果为正数的取模
 */
public static long mod(long x, int m) {
	return LongMath.mod(x, m);
}
 
Example 4
Source File: GuavaLongMathUnitTest.java    From tutorials with MIT License 4 votes vote down vote up
@Test
public void whenModLongAndIntegerValues_shouldModThemAndReturnTheResult() {
    int result = LongMath.mod(30L, 4);
    assertEquals(2, result);
}
 
Example 5
Source File: GuavaLongMathUnitTest.java    From tutorials with MIT License 4 votes vote down vote up
@Test
public void whenModTwoLongValues_shouldModThemAndReturnTheResult() {
    long result = LongMath.mod(30L, 4L);
    assertEquals(2L, result);
}
 
Example 6
Source File: MathUtil.java    From vjtools with Apache License 2.0 2 votes vote down vote up
/**
 * 保证结果为正数的取模.
 * 
 * 如果(v = x/m) <0,v+=m.
 */
public static long mod(long x, long m) {
	return LongMath.mod(x, m);
}
 
Example 7
Source File: MathUtil.java    From vjtools with Apache License 2.0 2 votes vote down vote up
/**
 * 保证结果为正数的取模.
 * 
 * 如果(v = x/m) <0,v+=m.
 */
public static long mod(long x, long m) {
	return LongMath.mod(x, m);
}
 
Example 8
Source File: MathUtil.java    From j360-dubbo-app-all with Apache License 2.0 2 votes vote down vote up
/**
 * 保证结果为正数的取模.
 * 
 * 如果(v = x/m) <0,v+=m.
 */
public static long mod(long x, long m) {
	return LongMath.mod(x, m);
}