SHARE
TWEET

Untitled

a guest Jan 18th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int bitNumber = b-(8*byteIndex);
  2. bitMask = 0x8>>(byte)bitNumber;
  3.    
  4. error: possible loss of precision
  5.    
  6. int bitNumber = b-(8*byteIndex);
  7. bitMask = 0x8>>2;
  8.    
  9. 48) int byteIndex;
  10. 49) byte bitMask;
  11. 50) int bitNumber;
  12.     // assign value to byteIndex
  13. 67) bitNumber = b-(8*byteIndex);
  14. 68) bitMask = 0x8>>bitNumber;
  15.    
  16. ...MyClass.java:68: error: possible loss of precision
  17.     bitMask = 0x8>>bitNumber;
  18.              ^
  19.   required: byte
  20.   found:    int
  21. 1 error
  22.    
  23. byte bitMask = (byte)(0x8>>(byte)bitNumber);
  24.    
  25. byte bitMask = (byte)(0x8>>bitNumber);
  26.    
  27. byte bitMask;
  28. int varInt1 = 3;
  29. final int finalVarInt2 = 3;
  30. final int finalVarInt3 = 4;
  31.  
  32. bitMask = 0x8>>varInt1;    // 1. Will not work.
  33. bitMask = 0x8<<3;          // 2. Will work
  34.  
  35. bitMask = 0x8<<4;          // 3. Will not work
  36. bitMask = 0x8<<finalVarInt2;   // 1. Will work
  37. bitMask = 0x8<<finalVarInt3;   // 2. Will not work
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top