Results 1 to 5 of 5
Thread: converting simple C code to Java
-
converting simple C code to Java
Hi People,
I am new to C programming and have very little idea on how to convert this following C code to Java:
Supposidily, this above code is doing a mapping of 'TT room code' to 'TRH room code', according to thsi following table:Java Code:* (DWORD *) roomcode = * (DWORD *) (roomcode + 1) + ((roomcode[0] & 1) ? 0x00000020:0) + ((roomcode[0] & 2) ? 0x00002000:0) + ((roomcode[0] & 4) ? 0x00200000:0) + ((roomcode[0] & 8) ? 0x20000000:0); roomcode[4] = 0;
TRH room code TT room code Binary Code
ABCD PABCD 0101 0000
aBCD AABCD 0100 0001
AbCD BABCD 0100 0010
abCD CABCD 0100 0011
ABcD DABCD 0100 0100
aBcD EABCD 0100 0101
AbcD FABCD 0100 0110
abcD GABCD 0100 0111
ABCd HABCD 0100 1000
aBCd IABCD 0100 1001
AbCd JABCD 0100 1010
abCd KABCD 0100 1011
ABcd LABCD 0100 1100
aBcd MABCD 0100 1101
Abcd NABCD 0100 1110
abcd OABCD 0100 1111
Could someone please give me soem hint on how to convert it to java?
Thanks.
- 10-25-2011, 05:10 PM #2
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
Re: converting simple C code to Java
Start by trying to understand what the C code is doing
- 10-25-2011, 05:28 PM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,395
- Blog Entries
- 7
- Rep Power
- 17
Re: converting simple C code to Java
What is the type of the 'roomcode' variable?
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
-
Re: converting simple C code to Java
i think it is better to write a simple java program instead of decoding this C code. But thanks anyway.
- 10-25-2011, 06:15 PM #5
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
Re: converting simple C code to Java
Understanding the code is what is needed, mindlessly translating code is simple, with enough banging on the keyboard you will figure something out eventually. This process is simply time consuming. If you understand what the c code does, it will take very little time to write the equivalent java code.
Similar Threads
-
Problem with simple code in Java ME SDK 3.0
By marvas in forum CLDC and MIDPReplies: 0Last Post: 10-13-2010, 06:58 PM -
Simple Java BlueJ Converting Program
By Mahoo in forum New To JavaReplies: 3Last Post: 08-04-2010, 05:28 AM -
Converting simple Java Application to Applet
By jrohde in forum Java AppletsReplies: 1Last Post: 07-25-2009, 07:48 PM -
please help in java code (simple)
By rahul_swe23 in forum New To JavaReplies: 4Last Post: 01-26-2009, 03:32 PM -
problem with a simple java code
By boy22 in forum New To JavaReplies: 2Last Post: 08-03-2007, 02:46 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks