How to look at individual bits of a short to see if 0 or 1

I am writing a program in which i send a command to someone and get a response back in the form of a short.
a short consists of 16 bits, how can i look at the bits individually to see if they are 1 or 0.
forexample say the short that comes back in binary is
in otherwords i want to start from the first bit and parse all of them to see if they are 1 or 0

short num = (short)0xAAAB;   // binary '1010101010101011'
        int mask = 1;
        for(int n=1; n<17; n++) {
             System.out.println("Bit " + n + " = " + ((num & mask) == mask ? "Set" : "Not set"));
             mask <<= 1;
        }---------- Capture Output ----------
"C:\WINDOWS\system32\java.exe" -cp . ZzBit 1 = Set
Bit 2 = Set
Bit 3 = Not set
Bit 4 = Set
Bit 5 = Not set
Bit 6 = Set
Bit 7 = Not set
Bit 8 = Set
Bit 9 = Not set
Bit 10 = Set
Bit 11 = Not set
Bit 12 = Set
Bit 13 = Not set
Bit 14 = Set
Bit 15 = Not set
Bit 16 = Set
Terminated with exit code 0.

Similar Messages

  • How do I look at individual items in cache history in Firefox 7.0.1?

    How do I look at individual items in cache history in Firefox 7.0.1? I tried using about:cache. I clicked on "List Cache Entries" (about:cache?device=disk) for the Disk Device Cache. I was looking for a quick solution, but Firefox was not responsive even 10-15 minutes later. I finally had to kill it off in Task Manager. I think there were about 75,000 entries. (only 1,309 now). I used to use a plug in called Cache View, but this probably does not work with the current version. Is there a very quick way to do this? I might need past data, that I forgot to save, and this might be the only way to get it.

    You can download this CacheViewer Version 0.7b
    *https://addons.mozilla.org/en-US/firefox/addon/cacheviewer/versions/
    You can either edit the file install.rdf in that zip archive or use this extension to make Firefox install it via File > Open File.
    *Add-on Compatibility Reporter: https://addons.mozilla.org/firefox/addon/add-on-compatibility-reporter/
    *http://kb.mozillazine.org/Editing_an_add-on_to_change_its_compatibility

  • Hello All... Back after a brief absence, things look a little bit different. I'm trying to take a 16 minute mini dv video and compress it for use on the web. I'm interested in any suggestions you may have on settings for the video and audio tracks. I'v

    Hello All...
    Back after a brief absence, things look a little bit different.
    I'm trying to take a 16 minute mini dv video and compress it for use on the web. I'm interested in any suggestions you may have on settings for the video and audio tracks. I've tried using Sorenson 3 (15 frames, key frames set to automatic, 320 x 240) for video and IMA 4:1 (mono) for audio. The resulting video looked great but the file size came in at about 255 Mb.
    Thanks!
    PowerMac G5 1.8 Dual   Mac OS X (10.4.3)  
    Message was edited by: Dan Foley

    Thank you for the replies.  Everyone was correct about the jack, interface, and phasing problems.  I have been unplugging my motu audio interface and then using headphones at work.  I have not changed any detailed audio output settings in logic.  When I read that the jack might be a problem I tried switching headphones.  This actually helped.  I am using dre-beats headphones and they seem to be having issues with the mac/jack-(the phasing/panning problems.  I can use these headphones with other devices but not the mac.  I have to use ipod ear buds and the phasing seems fixed.  Hopefully this information is helpful to someone else. 
    If anyone knows how to correct this issue please let me know its difficult to know what my final mixes are going to sound like and I have had to keep bouncing everything into i-tunes- sync to ipod and then listen in my car radio. 

  • How do I graph multiple bit values on one time axis?

    I want to graph multiple bit values, all of which will change back and forth from 0 to 1, on the same time axis, but I don't want any visual overlap between the different bit value traces.  Now I could do this by graphing bit one as either 0 or 1, bit 2 as 2 or 3, bit 3 as 4 or 5, etc., but I would really rather have multiple Y axes showing 0 to 1, stacked vertically on the same time (X) axis.
    You could visualize this as multiple pens on a strip chart continuously recording different values.  Each pen has its own vertical area in which it writes, but all pens could be writing data from the same numerical range.
    Hmmm...  I think my description might be roughly as clear as mud, but if anyone out there can figure out what I am asking and has potential solutions, please let me know.
    Thanks!

    Thanks.  I will look at that VI, but I think I have already seen it.  My problem is that I have CAN data coming in for an hour or so, but the time interval between receiving specific CAN arbitration IDs varies, so I want to plot the X axis against specific, varying time values, not a standard dT.  I'm not sure I can do this on a digital graph, but I haven't given up hope yet.
    BTW, I am receiving 8-byte CAN packages.  Some of the bytes represent actual values, but I need to break others up into individual bit values to see error and status flag settings.  Once I break the bytes into bits, I convert from analog values to digital values.

  • Hi looking for a bit of free  anti - virus and firewall for osx 10.8.2

    hi looking for a bit of free  anti - virus and firewall for osx 10.8.2 any pointers also any one used Mac cleaner ?

    1. This comment applies to malicious software ("malware") that's installed unwittingly by the victim of a network attack. It does not apply to software, such as keystroke loggers, that may be installed deliberately by an intruder who has hands-on access to the victim's computer. That threat is in a different category, and there's no easy way to defend against it. If you have reason to suspect that you're the target of such an attack, you need expert help.
    2. All versions of OS X since 10.6.7 have been able to detect known Mac malware in downloaded files. This feature is transparent to the user, but internally Apple calls it "XProtect." The recognition database is automatically updated once a day; however, you shouldn't rely on it, because the attackers are always at least a day ahead of the defenders.
    The following caveats apply to XProtect:
    It can be bypassed by some third-party networking software, such as BitTorrent clients and Java applets (see below.)
    It only applies to software downloaded from the network. Software installed from a CD or other media is not checked.
    3. Starting with OS X 10.7.5, there has been another layer of built-in malware protection, designated "Gatekeeper" by Apple. By default, applications and Installer packages downloaded from the network will only run if they're digitally signed by a developer with a certificate issued by Apple. Software certified in this way hasn't actually been tested by Apple (unless it comes from the Mac App Store), but you can be reasonably sure that it hasn't been modified by anyone other than the developer. His identity is known to Apple, so he could be held legally responsible if he distributed malware. For most practical purposes, applications recognized by Gatekeeper as signed can be considered safe.
    Gatekeeper has, however, the same limitations as XProtect, and in addition the following:
    It can easily be disabled or overridden by the user.
    A malware attacker could get control of a code-signing certificate under false pretenses, or could find some other way to evade Apple's controls.
    For more information about Gatekeeper, see this Apple Support article.
    4. Beyond XProtect and Gatekeeper, there’s no benefit, in most cases, from any other automated protection against malware. The first and best line of defense is always your own intelligence. All known malware circulating on the Internet that affects a fully-updated installation of OS X 10.6 or later takes the form of so-called "trojan horses," which can only have an effect if the victim is duped into running them. The threat therefore reduces to a battle of wits between you and the malware attacker. If you're smarter than he thinks you are, you'll win.
    That means, in practice, that you never use software that comes from an untrustworthy source. How do you know whether a source is trustworthy?
    Any website that prompts you to install a “codec,” “plug-in,” or “certificate” that comes from that same site, or an unknown one, is untrustworthy.
    A web operator who tells you that you have a “virus,” or that anything else is wrong with your computer, or that you have won a prize in a contest you never entered, is trying to commit a crime with you as the victim. (Some reputable websites did legitimately warn users who were infected with the "DNSChanger" malware. That exception to this rule no longer applies.)
    “Cracked” copies of commercial software downloaded from a bittorrent are likely to be infected.
    Software with a corporate brand, such as Adobe Flash Player, must be downloaded directly from the developer’s website. No intermediary is acceptable.
    5. Java on the network (not to be confused with JavaScript, to which it's not related) is a weak point in the security of any operating system. If a Java web plugin is not installed, don't install one unless you really need it. If it is installed, you should disable it (not JavaScript) in your web browsers. Few websites have Java content nowadays, so you won’t be missing much. This setting is mandatory in OS X 10.5.8 or earlier, because Java in those obsolete versions has known security flaws that make it unsafe to use on the Internet. The flaws will never be fixed. Regardless of version, experience has shown that Java can never be fully trusted, even if no vulnerabilities are publicly known at the moment.
    Follow these guidelines, and you’ll be as safe from malware as you can reasonably be.
    6. Never install any commercial "anti-virus" or "Internet security" products for the Mac, as they all do more harm than good. If you need to be able to detect Windows malware in your files, use the free software ClamXav — nothing else.
    Why shouldn't you use commercial "anti-virus" products?
    Their design is predicated on the nonexistent threat that malware may be injected at any time, anywhere in the file system. Malware is downloaded from the network; it doesn't materialize from nowhere.
    In order to meet that nonexistent threat, the software modifies or duplicates low-level functions of the operating system, which is a waste of resources and a common cause of instability, bugs, and poor performance.
    By modifying the operating system, the software itself may create weaknesses that could be exploited by malware attackers.
    7. ClamXav doesn't have these drawbacks. That doesn't mean it's entirely safe. It may report email messages that have "phishing" links in the body, or Windows malware in attachments, as infected files, and offer to delete or move them. Doing so can corrupt the Mail database. The messages should be deleted from within the Mail application.
    ClamXav is not needed, and should not be relied upon, for protection against OS X malware. It's useful only for detecting Windows malware. If you don't need to do that, avoid it. Windows malware can't harm you directly (unless, of course, you use Windows.) Just don't pass it on to anyone else.
    8. The greatest danger posed by anti-virus software, in my opinion, is its effect on human behavior. When people install such software, which does little or nothing to protect them from emerging threats, they get a false sense of security from it, and then they may do things that make them more vulnerable. Nothing can lessen the need for safe computing practices.
    9. It seems to be a common belief that the built-in Application Firewall acts as a barrier to infection, or prevents malware from functioning. It does neither. It blocks inbound connections to certain network services you're running, such as file sharing. It's disabled by default and you should leave it that way if you're behind a router on a private home or office network. Activate it only when you're on an untrusted network, for instance a public Wi-Fi hotspot, where you don't want to provide services. Disable any services you don't use.

  • Help!!! How do I get the bit color depth the user has his screen set to?

    Help!!! How do I get the bit color depth the user has his screen set to?
    Thank you.

    i'm not sure if it's what you 're looking for but it worked for me:
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gs = ge.getScreenDevices();
    for(int i=0;i<gs.length;i++){ //length is 1 (= i have only one screen? )
    GraphicsDevice g=gs[ i ];
    int nBits=g.getDisplayMode().getBitDepth(); //method getDisplayMode() only in jdk1.4 , i think
    System.out.println( nBits+"");
    output is 32 if i set my screen color to 32bits, 24 if...24, ...

  • How to Work in 32 Bit in Premier Pro Plug In

    As I understand it, Adobe Premier Pro doesn't support "Smart Render" mode as in After Effects.
    Yet I don't understand how does it support 32 Bit Per Channel input.
    I look at the SDK sample called SDK Noise, at the following code:
    PrPixelFormat destinationPixelFormat = PrPixelFormat_BGRA_4444_8u;
                    if (pixelFormatSuite) {
                            (*pixelFormatSuite->GetPixelFormat)(output, &destinationPixelFormat);
                            if (destinationPixelFormat == PrPixelFormat_BGRA_4444_8u){
                                    ERR(suites.Iterate8Suite1()->iterate(   in_dataP,
                                                                                                                     0,                                                              // progress base
                                                                                                                     linesL,                                                 // progress final
                                                                                                                     &params[NOISE_INPUT]->u.ld,             // src
                                                                                                                     NULL,                                                   // area - null for all pixels
                                                                                                                     (void*)&niP,                                    // refcon - your custom data pointer
                                                                                                                     FilterImageBGRA_8u,                             // pixel function pointer
                                                                                                                     output));     
                            } else if (destinationPixelFormat == PrPixelFormat_VUYA_4444_8u){
                                    ERR(suites.Iterate8Suite1()->iterate(   in_dataP,
                                                                                                                     0,                                                              // progress base
                                                                                                                     linesL,                                                 // progress final
                                                                                                                     &params[NOISE_INPUT]->u.ld,             // src
                                                                                                                     NULL,                                                   // area - null for all pixels
                                                                                                                     (void*)&niP,                                    // refcon - your custom data pointer
                                                                                                                     FilterImageVUYA_8u,                             // pixel function pointer
                                                                                                                     output));
                            } else if (destinationPixelFormat == PrPixelFormat_BGRA_4444_32f) {
                                    // Premiere doesn't support IterateFloatSuite1, so we've rolled our own
                                    IterateFloat(   in_dataP,
                                                                    0,                                                              // progress base
                                                                    linesL,                                                 // progress final
                                                                    &params[NOISE_INPUT]->u.ld,             // src
                                                                    (void*)&niP,                                    // refcon - your custom data pointer
                                                                    FilterImageBGRA_32f,                    // pixel function pointer
                                                                    output);      
                            } else if (destinationPixelFormat == PrPixelFormat_VUYA_4444_32f) {
                                    // Premiere doesn't support IterateFloatSuite1, so we've rolled our own
                                    IterateFloat(   in_dataP,
                                                                    0,                                                              // progress base
                                                                    linesL,                                                 // progress final
                                                                    &params[NOISE_INPUT]->u.ld,             // src
                                                                    (void*)&niP,                                    // refcon - your custom data pointer
                                                                    FilterImageVUYA_32f,                    // pixel function pointer
                                                                    output);      
                            } else {
                                    //      Return error, because we don't know how to handle the specified pixel type
                                    return PF_Err_UNRECOGNIZED_PARAM_TYPE;
                            err = AEFX_ReleaseSuite (
                                    in_dataP,
                                    out_data,
                                    kPFPixelFormatSuite,
                                    kPFPixelFormatSuiteVersion1,
                                    NULL);
    I removed some code related to errors.
    Yet even if I set the Render and the Sequence (Preview) to 32 Bit (Max Bit Depth) it still always selects 8 Bit Format.
    I don't understand how the pipeline should work in order to enable support for 32 Bit processing.
    Any assistance?
    How exactly does it work?

    Hi Royi,
    The pixel format requested depends on the action that triggered the render.  I went back to CS6 and I'm seeing the 32-bit YUV path taken, although for draft renders while scrubbing around in the timeline the 8-bit RGB path is used.

  • Using bitwise operators to swap individual bits

    I'm able to set or clear individual bits using masks, however I'm trying to figure out how I could go about swapping two bits using bitwise operators but I haven't been able to figure it out. For example, say I had int x = 37 which is 100101 in binary and I wanted to swap the 2nd and 3rd bits I'd like to get 100011 when I use Integer.toBinaryString(x) after performing some bitwise operations on x to swap bits around. Any suggestions ?

    How about something like this? A preliminary test seemed to work.
    class BitSwap2 {
      public static void main(String[] argv) {
        int x = 37;
        System.out.printf("Binary: %s\n", Integer.toBinaryString(x));
        swapBits(x, 2, 3);
      private static void swapBits(int x, int a, int b) {
        if(a == b) {
          System.out.printf("Nothing to swap.\n");
          return;
        int first = (x & (1<<(a-1)));
        int second = (x & (1<<(b-1)));
        // zero them out from the original so that we can swap them
        x ^= (first | second);
        if(a > b) {
          int diff = (a - b);
          x |= (first >> diff);
          x |= (second << diff);
        } else {
          int diff = (b - a);
          x |= (second >> diff);
          x |= (second << diff);
        System.out.printf("Binary: %s\n", Integer.toBinaryString(x));
    }

  • TabbedPanels Tab - How can we put individual images on each tab button?

    Hi,
    How can we put individual propeties (like size, background images etc) in each tab button of TabbedPanels Tab?
    Thanks

    Wow ! Itz amazing !! .... This is what 'm exactly looking for
    Thanks a lot Gramps
    Alin

  • How to look for the Table Name

    Hi Friends,
    Sometimes we need to download the table for the desired information if the same is not available from a particular report. How to look for the table name? Is there a report or a particular feild, where we can find the name of the particular table?
    Thanks for the assistance.
    Regards

    Hi Friend,
    If you want to see the structures then go to SE11. Sometimes it happens that you cannot find the table names but only fields. In such case, if you want to find the Table names which is not available, then go to SE90.
    Abap Dictionary > Fields > Table Fields.
    Now Enter the Field name in Right Hand Side of the screen then Execute. You will see the all tables by which that Fields are used.
    Regards,
    Jigar

  • How  to  look for  fi doc  number in cj88

    HI  expert:
          when I  run cj88.   the system generate FI  doc number.   how to look for FI doc number.
    can you tell me !
    thank you !!!!

    Hi,
    You can see the FI Doc. thru' given instruction
    Go to T-code CJI3 then fillup the WBS no. in which you want to see the Settlement document.
    Execute then filter up document type AA  double click on this & click on FI document.
    Hope it will solve your problem.
    Regards,
    Vishal Kr. Sharma

  • How to look for kMAT material in Testing client?

    Hi PP members:
    How to look for KMAT material in Test client,
    Note: I went to mm60 and entered material type: KMAT it did not populate any
    materials
    Is there any way where I can find the materials, If yes please let me know
    thanks
    Suren

    Hi Saritha:
    When I went to SE16, and entered MTART as KMAT it giving the following
    It is replying me back "No table entries found for specified key"
    Also want to bring to your kind attention I left MATNR field blank as I donot know
    the VC materials
    thanks

  • How to look for business partner number in GTS

    Hi Experts,
    How to look for the business partner number in GTS when we have the Customer Id number in r/3?
    Please let me know the path in GTS.
    Edited by: Anurag87 on Dec 9, 2010 2:17 PM

    Hello,
    just simple in GTS in transaction BP find by "3 External number" (which is yours R/3 number).
    Or in se16 table /SAPSLL/PNTBP type in field BPVSY you external number from R/3 system.
    Cheers,
    Gabriel.

  • How to look for a keyword in SAP MaxDB Library 7.6

    Hi,
    how to look for a keyword in SAP MaxDB Library 7.6 ( http://maxdb.sap.com/doc/7_6/7e/c3fb0e72fcf84580f7ee9fcec672b7/frameset.htm)
    Thank you.

    http://maxdb.sap.com/documentation/
    =>
    Section u201CDownloadu201D - HTMLHelp file < 7.8 or 7.7 version >
    HTMLHelp file
    .chm, full text search, print-optimized, 6.3 MB
    < download it or open it >
    < If downloaded, Then start on your server:
           maxdb-chmdoc-en-78_740.chm   >
    and type a keyword in field u201CType in the keyword find:u201D and search.
    Itu2019s working fine.
    Regards, Natalia Khlopina

  • How to look for sales order number if I know outbound delivery number?

    How to look for sales order number if I know outbound delivery number?

    Hi ,
        If you want to see the Sales order Number from Outbound delivery or invoice,go to their respective T-codes,say for example,
    for delivery,Goto Tcode: VL02N / VL03N.There you will find Document Flow Icon,click on that,or press F7.
    You will get a window,there you can see the Sales order Number before your outbound delivery Number
    With Thanks and Regards,
    Priya

Maybe you are looking for

  • Issue in GP

    Hello Guru's, We're implementing LWE's in our client and we are stuck with an issue in GP's We have created a custom Web Dynpro ABAP application for creating/modifying/deleting 378 record (Adjustment Reason) and the application is working fine. For i

  • Photoshop CS6 not working on new pc

    I bought a new laptop and have installed my Photoshop CS6 on it, but it won't work. I cannot open the old PSD files or even a photo or new blank page.

  • Entire itunes library is duplicated on my hard drive.  how do i fix it????

    after my hard drive crashed, i had to copy my entire library over to a new drive. in doing so, i ended up with duplicate files of most of my music. so, for example, on my hard drive (not in itunes)i have "don't funk with my heart" next to "don't funk

  • Column chart highlighted in black?

    I have a columnchart module in an application based on 100% width and height. When the chart gets loaded, the background is black as if it gets selected. I treid to set teh clipContent to false but, I have no luck. Any pointer? -Alan

  • Adobe Extension Manager says I don't have the latest version of photoshop. I am trying to install the watermark panel.

    Hi. I am trying to install the watermark panel plugin. I installed the extension manager, and when I tried to install the plugin, the extension manager said I don't have the latest version of photoshop. I thought when you paid into the creative cloud