本文整理了Java中nl.lxtreme.ols.util.NumberUtils.getBitMask()
方法的一些代码示例,展示了NumberUtils.getBitMask()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NumberUtils.getBitMask()
方法的具体详情如下:
包路径:nl.lxtreme.ols.util.NumberUtils
类名称:NumberUtils
方法名:getBitMask
[英]Returns the maximum value for the given bit count, e.g., ( 1 << aBitCount ) - 1.
[中]返回给定位计数的最大值,例如(1<<aBitCount)-1。
代码示例来源:origin: jawi/ols
/**
* Converts the given value into a desired bit order.
*
* @param aValue
* the value to convert;
* @param aBitCount
* the number of bits that are supposed to be in the given value;
* @param aBitOrder
* the desired bit order.
* @return the converted value.
*/
public static int convertBitOrder( final int aValue, final int aBitCount, final BitOrder aBitOrder )
{
if ( ( aBitCount <= 0 ) || ( aBitCount > 32 ) )
{
throw new IllegalArgumentException( "Bit count cannot be zero, negative or beyond 32-bits!" );
}
// We already have the most significant bit first, convert only if the bit
// order is LSB first...
if ( aBitOrder == BitOrder.MSB_FIRST )
{
return ( aValue & getBitMask( aBitCount ) );
}
return reverseBits( aValue, aBitCount );
}
代码示例来源:origin: jawi/ols
int mask = getBitMask( aBitCount );
while ( ( s >>= 1 ) > 0 )
代码示例来源:origin: jawi/ols
enabledChannels = NumberUtils.getBitMask( channels );
代码示例来源:origin: jawi/ols
/**
* Creates a mocked data set with a given number of sample/time values.
*
* @param aDataSize
* the number of sample/time values in the returned data container, >
* 0;
* @param aChannelCount
* the number of <em>enabled</em> channels in the returned data
* container, > 0 && < 32;
* @param aSampleRate
* the sample rate (in Hertz), > 0;
* @param aProvider
* the test data provider to use, cannot be <code>null</code>.
* @return a mocked data container, never <code>null</code>.
*/
public static DataSet createStubDataSet( final int aDataSize, final int aChannelCount, final int aSampleRate,
final TestDataProvider aProvider )
{
final int[] values = new int[aDataSize];
final long[] timestamps = new long[aDataSize];
aProvider.fillData( values, timestamps, aDataSize );
final StubDataSet project = new StubDataSet();
project.setCapturedData( new CapturedData( values, timestamps, 0, aSampleRate, aChannelCount, NumberUtils
.getBitMask( aChannelCount ), timestamps[aDataSize - 1] + 1L ) );
return project;
}
内容来源于网络,如有侵权,请联系作者删除!