You cannot. A basic numeric constant is considered an integer (or long if followed by a “L”), so you must explicitly downcast it to a byte to pass it as a parameter. As far as I know there is no shortcut.
More Related Contents:
- Convert a string representation of a hex dump to a byte array using Java?
- Java: how do I get a class literal from a generic type?
- Java Byte Array to String to Byte Array
- Convert integer into byte array (Java)
- How do I convert Long to byte[] and back in java
- What does value & 0xff do in Java?
- What is a class literal in Java?
- Java integer to byte array
- Is addition of byte converts to int because of java language rules or because of jvm?
- In Java 8, is there a ByteStream class?
- How to convert a byte to its binary string representation
- Java: object to byte[] and byte[] to object converter (for Tokyo Cabinet)
- byte array to short array and back again in java
- Java: BufferedImage to byte array and back
- How to Convert Int to Unsigned Byte and Back
- Why int j = 012 giving output 10?
- Convert binary string to byte array
- Convert a String to a byte array and then back to the original String
- Java creating byte array whose size is represented by a long
- Java: why do I receive the error message “Type mismatch: cannot convert int to byte”
- How to get the value of a bit at a certain position from a byte?
- Convert short to byte[] in Java
- Are there binary literals in Java?
- James Gosling’s explanation of why Java’s byte is signed
- Java string intern and literal
- What is the best way to work around the fact that ALL Java bytes are signed?
- Why does the xor operator on two bytes produce an int?
- How to convert byte[] to Byte[] and the other way around?
- Java Iterate Bits in Byte Array
- Searching for a sequence of Bytes in a Binary File with Java