Parsing machine code

I have a need for a program that can parse a 4-digit hexadecimal code and take action on it. The first and last digits are frequently the most important, but all of the digits can be varied. I have several methods in mind, but what is the fastest or most efficient way in java to operate on the digits individually?

You could do something similar to this.
public class HexToInt {
     public static void main(String args[]){
          String hex = "A7FE"; //Hexadecimal number
          int count = hex.length();
          String[] c = new String[count];
          for(int i = 0; i < count; i++){
               c[i] = String.valueOf(hex.charAt(i)); //Grab single hex character
               System.out.println("Hex digit at element " + i + " is " + convert(c)); //Convert character to integer
     public static int convert(String hex){
          return Integer.valueOf(hex, 16);
}I'm not exactly sure if this was the kind of action you were looking for, but this is just a simple program that converts a single hexadecimal character from a string and prints it out as an integer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Code to parse java code

    anyone know where we can get the code that parses the Java code that we put here ?
    i was thinking it would be a good base to use as a pre-compiler project - so we can have pre-compiler flags like in c - say to include logging ...
    example of the code formatting at work:
    class Rename{
      * Rename a file from command line,
      * args[0] is the existing file name
      * args[1] is the new file name
      public static void main (String[] args)
       try{
        java.io.File fExisting = new java.io.File(args[0]);   
        java.io.File fNew = new java.io.File(args[1]);
        if(!fExisting.exists()){
         System.out.println("Rename will fail as source does not  exist. Exiting");
         return;
        if(fNew.exists()){
         System.out.println("Rename might fail as target already exits - delete it first ");
        System.out.println("attempt rename :\n" + fExisting.getAbsolutePath() + "\n to:\n" + fNew.getAbsolutePath() );
        boolean b = fExisting.renameTo(fNew);
        if(b){
         System.out.println("Done ok ");
        }else{
         System.out.println("rename failed ");
       }catch(Throwable e){
        System.out.println("Could not rename " + e);
        e.printStackTrace();
    synchrozied (objSync){
    try{
      while(bPause){
       Thread.sleep(250);  
      }catch(Throwable e){
       //can ignore
    }would be a nice source forge project - unless there is already one out there

    Try this link from Javaranch - I started reading it, but got distracted and did not pursue it very far. It's about JFlex parser and an example of parsing java code is provided or linked to:
    http://www.javaranch.com/journal/2008/04/Journal200804.jsp#a4
    Look for the section titled: "Handling Uncommon File Formats - Introducing Lexers"

  • Compile a Java code to a native machine code

    Hi Everyone,
    What tool do I need to compile a Java code to a native machine code? Is there any free tool?
    Cecilia

    google.com is a good place to start

  • How do I compile my Java directly to machine code?

    Let's say I'm making an application that isn't going to be run from the internet, so I wish to compile it directly to Windows (or UNIX or whatever) so that it runs faster. I would like to compile java code to machine code, not to byte code. Is there any way to do this?

    I'd not develop such an application in java to be frank. In any case there are several exe generators available (example zerog). But they mandate you have JRE installed on the machine where you are going to run your exe, else your exe would comtain jre in which case he size would be enormous. Either way you are a loser.

  • PixelBender in Flash no longer compiles to machine code?

    It appears that the latest version of Flash (11.7.700.232 / 11.8.800.94) has removed support for Just-In-Time compilation of PixelBender shader programs into machine code. For example, you can compare the FPS of this animation:
    http://spinningowl.com/flash_experiments/PBTest_CPU.html?placeValuesBeforeTB_=savedValues& TB_iframe=true&height=660&width=650&modal=false
    with the latest Flash vs. any previous versions, and the FPS on the latest Flash runs at nearly a fivefold slowdown. I've verified that the PixelBender program is no longer running directly via machine code, but is instead interpreted by the runtime.
    Is there something different that has to be set via the wmode parameter or some other HTML parameter to maintain the old behavior? Or has JIT support been dropped entirely from PixelBender?

    Here is an email I received about this issue from an Adobe engineer:
    ...this was a permanent change that was made to address a security issue with the player. In our decision making we believed that this feature was seldom used and that while falling back to the interpreter would be slower, since the feature was designed 5 years ago, current desktop system speeds should help compensate for the decreased performance. We also believed that performance should be acceptable on mobile for small filtered areas (it's been implemented in interpreted mode on mobile from the beginning.)
    We are still gathering feedback from customers on [this] bug report and there are internal discussions about the ramifications of this change.
    So it looks as though this change is not going to be reversed any time soon, given that there are security implications.
    The only workaround is to reduce the dimensions of the bitmapData object that the Pixel Bender shader uses. This will improve frame rate performance, but will of course mean images will be pixelated if the bitmapData is then enlarged to its previous size.

  • 101215 Malformed Request "/mbo/adaptadormx/testSGE". Request parsing failed, code: -10 at myserver.log?

    Oracle Gateway 11.5.9 is sending an HTTP Request to a servlet mapped at WebLogic
    7.0 SP2. Next message appends to myserver.log :
    ####<Jan 23, 2004 5:25:51 PM CET> <Error> <HTTP> <desarrollo.anaya.es> <MAXIMOSERVER>
    <ExecuteThread: '13' for queue: 'default'> <kernel identity> <> <101215> <Malformed
    Request "/mbo/adaptadormx/testSGE". Request parsing failed, code: -10>
    However if I send a Request via Internet Explorer 6.0. The servlet works properly
    as posted in access.log:
    10.4.0.5 - - [20/Jan/2004:13:38:03 +0100] "POST /mbo/adaptadormx/testSGE HTTP/1.0"
    200 0
    My servlet is a debug one that just prints echo parameters of the request. But
    I think is not servlet business because the request does not reach to it, because
    Weblogic does not recognize the Request.
    Any idea of this issue? Oracle issue? WebLogic issue?Thanks in advance.
    PD: I don't really know if this is the proper newsgroup to post current message
    so if somebody know anyplace better (even outer-Bea), please reply me. Thanks.

    Check if there is white space in the url you are sending, it is one reason server can give malformed request error

  • CC Need New Machine Code After Hardware Change

    Following a motherboard change caused by lightening, I am unable to get CC out of "trial" mode. How do I request a new machine code, if that is what is needed. I can sign in and have re-installed my subscription programs, but cannot activate programs. I get an error stating that the program is unable to connect to Internet during attempts to activate. Thanks for any help.

    See if the following helps at all...
    Sign in, activation, or connection errors | CS5.5 and later
    https://helpx.adobe.com/x-productkb/policy-pricing/activation-network-issues.html

  • Viewing JRockit generated machine code

    Hello,
    Is there an easy way of getting a assembler/machine code dump of an
    optimized method/class in the JRockit JVM?
    /Jesper Nordenberg

    Short answer: no.
    Regards,
    /Staffan

  • Capture JVM output machine code

    Does anybody know how to capture the machine code output from the JVM? I am running Windows Vista Professional.
    I ask because I am creating a Computer Architecture course, and I would like to show the students the IA instructions that are generated by the JVM. The textbooks I have been investigating traditionally introduce assembly language by way of C++. The problem is that these students are taught programming using Java. I know the Java compiler output is bytecode, but this does not help me teach the actual architecture of the computer.
    Thanks in advance.

    Thanks all for you replies
    georgemc: What you are saying is that while one can recognize a method that was written in Java in the bytecode, there is no relation between the original method (or the corresponding bytecode for that matter), and the machine code output of the JVM? For example, using Visual C++ once can view the disassembly of a method and see the IA assembly language, the values of the registers (including the flags register).
    paulcw: Thanks for the suggestion. Your approach may work for future sessions, but I am afraid I do not have time to implement for this coming semseter
    Captain Obvious (nice name): I had thought of taking an approach similar to your posting. However, I must cover specific topics in the class and there will not be time. For instance, I am expected to cover representing and manipulating information, machine-level representation of programs, processor architecture, optimizing program performance, memory hierarchy, exceptional control flow, and virtual memory. The difficulty some students encounter is that, up until this course, have been taught only Java programming. Then, they take this course which teaches everything from a C/C++ perspective. I was hoping I could demonstrate machine code in C++, as well as Java in an attempt to keep all levels of students engaged.

  • Machine code

    How can I compile Java bytecode into machine code(Intel Pentium III)?

    search for java and executable on how to convert it to an exe file. There is something called JET and java2exe and so on.

  • Random shutdown and machine code

    G4 shuts down at random. Or goes down to machine code and requires "macboot". Graphics card Radeon 9000. Help.

    perhaps a little more info of your machines make model etc.
    otherwise not sure what to tell you based on the 2 sentences.
    have you... Tried to Zap PRAM, checked PRAM battery, checked Power supply, how old is the computer? How Much RAM does the computer have?. did you recently upgrade RAM? Do Dance the Peppermint Twist in your Underwear?Did you recently add a new HD? Have you reseated your Video grpahics card? did you Press the CUDA reset switch? Did you Soak your Keyboard in Maple Syrup? Have you have other Kernel Panics before?
    Did you recently upgrade your OS? Have you run your apple hardware test?
    ridicuclous? you bet... more info always helps when diagnosing problems.

  • Oracle Text query parser - sample code

    I've posted a new entry on my "searchtech" blog which includes code for a "Google-like" query syntax parser:
    https://blogs.oracle.com/searchtech/entry/oracle_text_query_parser
    Currently it's just sample code, but if it goes down well we might include it, or something similar, in a future release of the product.
    I'd very much welcome feedback on it, either here on the forum, or on the blog, or directly to me email address (which is included in the download file).
    Thanks, everyone.

    When I select the "open in browser" option for each now, I get formatted, readable code, which can easily be copied and pasted into a file without the extra txt extension, and I much prefer that. So, for me, that is a sufficient fix.
    It seems like this is handy, virtually idiot-proof code, easy to create the package, easy to use it, and provides the Google-like search that users expect, without raising errors or producing unexpected results. Frequently, on the OraFAQ forums, where I am a moderator, when there are various ways to solve a problem and I provide a Text solution, the complaint is that it is too complicated to create all of the formatting to fix potential problems with user input. Your code solves that problem and I hope it will be included in the next version. If you don't mind, I will post an announcement in the OraFAQ Text forum with the permanent link that you provided.

  • CNC Machine Code: G Code Ignored for Mac!

    Why are there no good CNC G-Code programs like MasterCAM for Mac?  Machinists use G Code.  It is a very basic language.  There are really no good programs on Mac to generate CORRECT code. 
    Obviously, knowledge of MACHINING is of PARAMOUNT IMPORTANCE here.

    The Java Update has caused other problems. Search the board. Macintouch discovered that it is more strict about the path to the Java engine, which may explain a lot of issues:
    http://www.macintouch.com/readerreports/java/index.html#d29oct2010
    I'd pass that on to the publishers of the various IDEs.

  • Vending machine code

    anychance someone can help me with some code, ive got to create a vending machine in jdev that serves coffee, tea and an option for sugar, can any1 help me as i havnt a clue
    thanks

    > its not like i hvnt done anyfin
    Write in clear, grammatical, correctly-spelled language
    We've found by experience that people who are careless and sloppy writers are usually also careless and sloppy at thinking and coding (often enough to bet on, anyway). Answering questions for careless and sloppy thinkers is not rewarding; we'd rather spend our time elsewhere.
    So expressing your question clearly and well is important. If you can't be bothered to do that, we can't be bothered to pay attention. Spend the extra effort to polish your language. It doesn't have to be stiff or formal -- in fact, hacker culture values informal, slangy and humorous language used with precision. But it has to be precise; there has to be some indication that you're thinking and paying attention.
    Spell, punctuate, and capitalize correctly. Don't confuse "its" with "it's", "loose" with "lose", or "discrete" with "discreet". Don't TYPE IN ALL CAPS; this is read as shouting and considered rude. (All-smalls is only slightly less annoying, as it's difficult to read. Alan Cox can get away with it, but you can't.)
    More generally, if you write like a semi-literate boob you will very likely be ignored. Writing like a l33t script kiddie hax0r is the absolute kiss of death and guarantees you will receive nothing but stony silence (or, at best, a heaping helping of scorn and sarcasm) in return.
    If you are asking questions in a forum that does not use your native language, you will get a limited amount of slack for spelling and grammar errors -- but no extra slack at all for laziness (and yes, we can usually spot that difference). Also, unless you know what your respondent's languages are, write in English. Busy hackers tend to simply flush questions in languages they don't understand, and English is the working language of the Internet. By writing in English you minimize your chances that your question will be discarded unread.
    Best of luck.

  • Runtime parse source code

    Hi all,
    I build small java editor and I have big problem.
    Do you know how can I read name or type variable from source code and check variable is local or global .
    I found package "com.sun.mirror.declaration" but I don't know how to use interface in this package.
    How can I do it?

    Sorry,
    I mean range of variable in source code. For example:
    int b=2;
    public a() {
    String b="constructor range";
    System.out.print(b); // return "constructor range"
    I need tools or class which checks range of variable in source code and may return atribut variable.
    This tools I want assign to may application writen in Java.
    Pleeeease Help.

Maybe you are looking for

  • Sms delay

    Hi!I have problem with sms.My phone is Nokia N97 mini and my sms delay to come 1 day!please HELP me!

  • Premium Message Blocking - What does recipient and sender see?

    I recently blocked all texts that could come via a website or PC under the Verizon Safeguards link because I was receiving harrassing texts, and I am wondering what would I see if someone were to attempt to send me a text from their email or website?

  • Populating values of one table to other in dynamic tables

    Hi Experts , An issues here. <lt_data> is a table with different field lenghts. <itab> is a table of different field lenghts. Here how do i need to excatly put the records of each field into corresponding fileds of itab. the two tables are not compat

  • Vmware workstations 10

    Every time that I launch VMware workstations 10  i get the error : Unable to stop services. 2014-01-01T17:07:20.299Z| vthread-3| I120: Log for VMware Workstation pid=2285 version=10.0.1 build=build-1379776 option=Release 2014-01-01T17:07:20.299Z| vth

  • Where are my apps!? They aren't in the library anymore...

    I have bought apps before and then synced and they transferred to my library fine, but suddenly I cant see any of my apps in the library, its just blank, and i've tried syncing it - nothing. It still has all my music etc. but no apps in the library!