Click here to Skip to main content
15,887,267 members
Home / Discussions / Java
   

Java

 
QuestionC to Java translation Pin
Kujtim Hyseni13-Jan-14 5:03
Kujtim Hyseni13-Jan-14 5:03 
AnswerRe: C to Java translation Pin
Richard MacCutchan13-Jan-14 5:23
mveRichard MacCutchan13-Jan-14 5:23 
AnswerRe: C to Java translation Pin
Kujtim Hyseni13-Jan-14 6:08
Kujtim Hyseni13-Jan-14 6:08 
GeneralRe: C to Java translation Pin
Richard MacCutchan13-Jan-14 7:18
mveRichard MacCutchan13-Jan-14 7:18 
GeneralRe: C to Java translation Pin
Kujtim Hyseni13-Jan-14 7:24
Kujtim Hyseni13-Jan-14 7:24 
GeneralRe: C to Java translation Pin
Richard MacCutchan13-Jan-14 7:39
mveRichard MacCutchan13-Jan-14 7:39 
GeneralRe: C to Java translation Pin
Kujtim Hyseni13-Jan-14 7:41
Kujtim Hyseni13-Jan-14 7:41 
GeneralRe: C to Java translation Pin
Richard MacCutchan13-Jan-14 23:14
mveRichard MacCutchan13-Jan-14 23:14 
You have to get the value as an integer and then mask off the low order 8 bits, to make it into an unsigned value, like this:
Java
public static void main(String[] args) throws Exception {
    byte b1 = (byte)129;   // b1 is the original unsigned value, which takes the full 8 bits
    byte b2 = 4;           // b2 is a normal value
    int i1 = b1;           // make b1 an integer
    int i2 = i1 & 0xFF;    // mask off all but the low order 8 bits, i.e. the original byte value
    int i3 = i2 + b2;      // add the two original values together
    System.out.println("i1 is: " + i1);  // the negative byte value, same as b1
    System.out.println("i2 is: " + i2);  // the unsigned value
    System.out.println("i3 is: " + i3);  // the sum of the two numbers
}

[edit]Fixed typo; I meant low order 8 bits.[/edit]
Veni, vidi, abiit domum


modified 14-Jan-14 11:02am.

AnswerRe: C to Java translation Pin
thatraja13-Jan-14 6:43
professionalthatraja13-Jan-14 6:43 
AnswerRe: C to Java translation Pin
jschell13-Jan-14 9:25
jschell13-Jan-14 9:25 
QuestionResize objects from an ArrayList Pin
ririsuperstar11-Jan-14 4:44
ririsuperstar11-Jan-14 4:44 
Questionjava technology Pin
Member 1051702110-Jan-14 16:25
Member 1051702110-Jan-14 16:25 
AnswerRe: java technology Pin
Richard Andrew x6410-Jan-14 16:44
professionalRichard Andrew x6410-Jan-14 16:44 
GeneralRe: java technology Pin
Richard MacCutchan10-Jan-14 22:11
mveRichard MacCutchan10-Jan-14 22:11 
AnswerRe: java technology Pin
Richard MacCutchan10-Jan-14 22:11
mveRichard MacCutchan10-Jan-14 22:11 
QuestionWould like to retrieve RGB pixel values from another method but couldn't retrieve it Pin
nurul azila9-Jan-14 5:02
nurul azila9-Jan-14 5:02 
QuestionRe: Would like to retrieve RGB pixel values from another method but couldn't retrieve it Pin
Richard MacCutchan9-Jan-14 21:17
mveRichard MacCutchan9-Jan-14 21:17 
QuestionProblem is to classify whether the video on YouTube is harassment type or not... Pin
nishaaggarwal8-Jan-14 22:39
nishaaggarwal8-Jan-14 22:39 
QuestionRe: Problem is to classify whether the video on YouTube is harassment type or not... Pin
Richard MacCutchan8-Jan-14 23:39
mveRichard MacCutchan8-Jan-14 23:39 
QuestionCode to convert from C# to Java (with goto) Pin
Kujtim Hyseni8-Jan-14 9:00
Kujtim Hyseni8-Jan-14 9:00 
AnswerRe: Code to convert from C# to Java (with goto) Pin
gettgotcha8-Jan-14 9:20
gettgotcha8-Jan-14 9:20 
AnswerRe: Code to convert from C# to Java (with goto) Pin
Richard MacCutchan8-Jan-14 22:24
mveRichard MacCutchan8-Jan-14 22:24 
GeneralRe: Code to convert from C# to Java (with goto) Pin
Kujtim Hyseni9-Jan-14 1:45
Kujtim Hyseni9-Jan-14 1:45 
GeneralRe: Code to convert from C# to Java (with goto) Pin
Richard MacCutchan9-Jan-14 1:52
mveRichard MacCutchan9-Jan-14 1:52 
QuestionTool for generating JNI (calling C/C++ code from java) Pin
doofx8-Jan-14 3:19
doofx8-Jan-14 3:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.