@@ -195,25 +195,29 @@ public Number bytesToValueRealOffset(byte[] data, int offset) {
195
195
196
196
//MOD10K types
197
197
if (dataType == DataType .FOUR_BYTE_MOD_10K )
198
- return BigInteger .valueOf ((((data [offset + 2 ] & 0xff ) << 8 ) + (data [offset + 3 ]& 0xff )) )
199
- .multiply ( BigInteger . valueOf ( 10000L )). add (BigInteger .valueOf ((((data [offset ] & 0xff ) << 8 ) + (data [offset + 1 ] & 0xff ))));
198
+ return BigInteger .valueOf ((((data [offset + 2 ] & 0xff ) << 8 ) + (data [offset + 3 ] & 0xff ))). multiply ( BigInteger . valueOf ( 10000L ) )
199
+ .add (BigInteger .valueOf ((((data [offset ] & 0xff ) << 8 ) + (data [offset + 1 ] & 0xff ))));
200
200
if (dataType == DataType .FOUR_BYTE_MOD_10K_SWAPPED )
201
- return BigInteger .valueOf ((((data [offset ] & 0xff ) << 8 ) + (data [offset + 1 ] & 0xff )))
202
- .multiply ( BigInteger . valueOf ( 10000L )). add (BigInteger .valueOf ((((data [offset + 2 ] & 0xff ) << 8 ) + (data [offset + 3 ] & 0xff ))));
201
+ return BigInteger .valueOf ((((data [offset ] & 0xff ) << 8 ) + (data [offset + 1 ] & 0xff ))). multiply ( BigInteger . valueOf ( 10000L ))
202
+ .add (BigInteger .valueOf ((((data [offset + 2 ] & 0xff ) << 8 ) + (data [offset + 3 ] & 0xff ))));
203
203
if (dataType == DataType .SIX_BYTE_MOD_10K )
204
- return BigInteger .valueOf ((((data [offset +4 ] & 0xff ) << 8 ) + (data [offset + 5 ]& 0xff ))).multiply (BigInteger .valueOf (100000000L )).add (BigInteger .valueOf ((((data [offset +2 ] & 0xff ) << 8 ) + (data [offset + 3 ]& 0xff )))
205
- .multiply (BigInteger .valueOf (10000L ))).add (BigInteger .valueOf ((((data [offset ] & 0xff ) << 8 ) + (data [offset + 1 ]& 0xff ))));
204
+ return BigInteger .valueOf ((((data [offset + 4 ] & 0xff ) << 8 ) + (data [offset + 5 ] & 0xff ))).multiply (BigInteger .valueOf (100000000L ))
205
+ .add (BigInteger .valueOf ((((data [offset + 2 ] & 0xff ) << 8 ) + (data [offset + 3 ] & 0xff ))).multiply (BigInteger .valueOf (10000L )))
206
+ .add (BigInteger .valueOf ((((data [offset ] & 0xff ) << 8 ) + (data [offset + 1 ] & 0xff ))));
206
207
if (dataType == DataType .SIX_BYTE_MOD_10K_SWAPPED )
207
- return BigInteger .valueOf ((((data [offset ] & 0xff ) << 8 ) + (data [offset + 1 ]& 0xff ))).multiply (BigInteger .valueOf (100000000L )).add (BigInteger .valueOf ((((data [offset +2 ] & 0xff ) << 8 ) + (data [offset + 3 ]& 0xff )))
208
- .multiply (BigInteger .valueOf (10000L ))).add (BigInteger .valueOf ((((data [offset ] & 0xff ) << 8 ) + (data [offset + 1 ]& 0xff ))));
208
+ return BigInteger .valueOf ((((data [offset ] & 0xff ) << 8 ) + (data [offset + 1 ] & 0xff ))).multiply (BigInteger .valueOf (100000000L ))
209
+ .add (BigInteger .valueOf ((((data [offset + 2 ] & 0xff ) << 8 ) + (data [offset + 3 ] & 0xff ))).multiply (BigInteger .valueOf (10000L )))
210
+ .add (BigInteger .valueOf ((((data [offset + 4 ] & 0xff ) << 8 ) + (data [offset + 5 ] & 0xff ))));
209
211
if (dataType == DataType .EIGHT_BYTE_MOD_10K )
210
- return BigInteger .valueOf ((((data [offset +6 ] & 0xff ) << 8 ) + (data [offset + 7 ]& 0xff ))).multiply (BigInteger .valueOf (1000000000000L )).add (BigInteger .valueOf ((((data [offset +4 ] & 0xff ) << 8 ) + (data [offset + 5 ]& 0xff )))
211
- .multiply (BigInteger .valueOf (100000000L ))).add (BigInteger .valueOf ((((data [offset +2 ] & 0xff ) << 8 ) + (data [offset + 3 ]& 0xff ))).multiply (BigInteger .valueOf (10000L )))
212
- .add (BigInteger .valueOf ((((data [offset ] & 0xff ) << 8 ) + (data [offset + 1 ]& 0xff ))));
212
+ return BigInteger .valueOf ((((data [offset + 6 ] & 0xff ) << 8 ) + (data [offset + 7 ] & 0xff ))).multiply (BigInteger .valueOf (1000000000000L ))
213
+ .add (BigInteger .valueOf ((((data [offset + 4 ] & 0xff ) << 8 ) + (data [offset + 5 ] & 0xff ))).multiply (BigInteger .valueOf (100000000L )))
214
+ .add (BigInteger .valueOf ((((data [offset + 2 ] & 0xff ) << 8 ) + (data [offset + 3 ] & 0xff ))).multiply (BigInteger .valueOf (10000L )))
215
+ .add (BigInteger .valueOf ((((data [offset ] & 0xff ) << 8 ) + (data [offset + 1 ] & 0xff ))));
213
216
if (dataType == DataType .EIGHT_BYTE_MOD_10K_SWAPPED )
214
- return BigInteger .valueOf ((((data [offset ] & 0xff ) << 8 ) + (data [offset + 1 ]& 0xff ))).multiply (BigInteger .valueOf (1000000000000L )).add (BigInteger .valueOf ((((data [offset +2 ] & 0xff ) << 8 ) + (data [offset + 3 ]& 0xff )))
215
- .multiply (BigInteger .valueOf (100000000L ))).add (BigInteger .valueOf ((((data [offset +4 ] & 0xff ) << 8 ) + (data [offset + 5 ]& 0xff ))).multiply (BigInteger .valueOf (10000L )))
216
- .add (BigInteger .valueOf ((((data [offset +6 ] & 0xff ) << 8 ) + (data [offset + 7 ]& 0xff ))));
217
+ return BigInteger .valueOf ((((data [offset ] & 0xff ) << 8 ) + (data [offset + 1 ] & 0xff ))).multiply (BigInteger .valueOf (1000000000000L ))
218
+ .add (BigInteger .valueOf ((((data [offset + 2 ] & 0xff ) << 8 ) + (data [offset + 3 ] & 0xff ))).multiply (BigInteger .valueOf (100000000L )))
219
+ .add (BigInteger .valueOf ((((data [offset + 4 ] & 0xff ) << 8 ) + (data [offset + 5 ] & 0xff ))).multiply (BigInteger .valueOf (10000L )))
220
+ .add (BigInteger .valueOf ((((data [offset + 6 ] & 0xff ) << 8 ) + (data [offset + 7 ] & 0xff ))));
217
221
218
222
// 8 bytes
219
223
if (dataType == DataType .EIGHT_BYTE_INT_UNSIGNED ) {
@@ -342,19 +346,19 @@ public short[] valueToShorts(Number value) {
342
346
long l = value .longValue ();
343
347
return new short [] { (short ) (l %10000 ), (short ) ((l /10000 )%10000 )};
344
348
}
345
- if (dataType == DataType .SIX_BYTE_MOD_10K ) {
349
+ if (dataType == DataType .SIX_BYTE_MOD_10K_SWAPPED ) {
346
350
long l = value .longValue ();
347
351
return new short [] { (short ) ((l /100000000L )%10000 ), (short ) ((l /10000 )%10000 ), (short ) (l %10000 ) };
348
352
}
349
- if (dataType == DataType .SIX_BYTE_MOD_10K_SWAPPED ) {
353
+ if (dataType == DataType .SIX_BYTE_MOD_10K ) {
350
354
long l = value .longValue ();
351
355
return new short [] { (short ) (l %10000 ), (short ) ((l /10000 )%10000 ), (short )((l /100000000L )%10000 )};
352
356
}
353
- if (dataType == DataType .EIGHT_BYTE_MOD_10K ) {
357
+ if (dataType == DataType .EIGHT_BYTE_MOD_10K_SWAPPED ) {
354
358
long l = value .longValue ();
355
359
return new short [] { (short )((l /1000000000000L )%10000 ), (short ) ((l /100000000L )%10000 ), (short ) ((l /10000 )%10000 ), (short ) (l %10000 ) };
356
360
}
357
- if (dataType == DataType .EIGHT_BYTE_MOD_10K_SWAPPED ) {
361
+ if (dataType == DataType .EIGHT_BYTE_MOD_10K ) {
358
362
long l = value .longValue ();
359
363
return new short [] { (short ) (l %10000 ), (short ) ((l /10000 )%10000 ), (short )((l /100000000L )%10000 ), (short )((l /1000000000000L )%10000 )};
360
364
}
0 commit comments