- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Program to get the value stored in a byte as an unsigned integer
Let us first create signed byte −
byte signedVal = -100;
Now convert a byte to an unsigned integer −
int unsignedVal = Byte.toUnsignedInt(signedVal);
Example
public class Demo { public static void main(String[] args) { byte signedVal = -100; int unsignedVal = Byte.toUnsignedInt(signedVal); System.out.println("Signed value (byte) = " + signedVal); System.out.println("Unsigned value (byte) = " + unsignedVal); } }
Output
Signed value (byte) = -100 Unsigned value (byte) = 156
- Related Articles
- Java Program to convert an UNSIGNED byte to a JAVA type
- C# Program to convert a Byte value to an Int32 value
- Java Program to get highest key stored in TreeMap
- Java Program to get the reverse of an Integer array with Lambda Expressions
- Convert varchar to unsigned integer in MySQL
- Java Program to return the hexadecimal value of the supplied byte array
- Java Program to get the Characters in a String as an Array of Bytes
- Convert the value of the specified Decimal to the equivalent 16-bit unsigned integer in C#
- How to get the Checksum of a Byte Array in Java?
- Java Program to Print an Integer
- C# Program to convert a Double to an Integer Value
- Golang Program To Get The Successor Of An Integer Number
- Golang Program to Convert String Value to Byte Value
- Write a Java program to find the first array element whose value is repeated an integer array?
- Can we cast a double value to a byte in java?

Advertisements