From bit array (boolean[]) to int and back

(First of, I have searched hi and low, and have only found bits to bytes examples.)
Simple question folks, I hope.
How to convert a boolean[] array to an int or Integer, and from an int to a boolean array?
I wouldn't mind using BitSet instead of primitives if that would help, but that api also does not supply a quick toInteger or valueOfInteger method.
Please advise.
Thanks, nat.

You could use the bitwise operators:
http://java.sun.com/docs/books/tutorial/java/nutsandbo
lts/bitwise.html
Especially see the part about "flags".Am aware of that and indeed use this. However, sometimes a boolean array is more convenient or a must (using the "flags", my constants have to be 2,4,8,16,32,64,128...) and
I am dealing with a class that already has constants from 1 thru 21, and I want to add on to that class a boolean per constant, to track stuff I am adding to that class.
Anyhow, is it THAT complex to convert from a boolean array to an int?
nat

Similar Messages

  • Access 2010 on 64 Bit Windows 7 Access "Not Responding" when changing from forms view to design view and back

    I am running
    Windows 7 64 bit
    Access 2010 32 bit
    Developing an application with a split FE BE with both files local but continue to have the message "Not Responding" when switching from forms view to design view and back as well as if I try to connect to a subform or object on the sub form.

    I have seen this behavior when the form's RecordSource is a complex query such as a crosstab or a query with several nested queries. To test if this is your case, remove the RecordSource and see if the form starts acting normal again.
    Then again, if the form has several subforms they might be slowing up the loading time.
    Bill Mosca
    www.thatlldoit.com
    http://tech.groups.yahoo.com/group/MS_Access_Professionals

  • I synced my iPhone with iTunes, and it deleted all my music on my computer and my iPhone except for what I'd purchased using the iPhone. The rest of my music is still on my iPad, so how do I get it from my iPad to the computer, and back on my phone?

    The rest of my music is still on my iPad, so how do I get it from my iPad to the computer, and back on my phone? All my music is sitting there safely on my iPad, but whenever I try to sync it with my computer the only option I get is to wipe the iPad and replace it with the files on the computer---which is only a fraction of what I had originally. How do I fix this?? It even deleted my playlists, and I now only have some 200 songs left out of what used to be over 1000!

    It can not do that all by itself.
    When you plugged it in, iTunes said 'Oh goody! You got a new phone! Would you like to make it just like your old phone?'...
    You explicitly said 'Yes'.
    You can't undo that.
    No backup of the current state of the new phone was made. It was wiped and the last backup of your old phone was restored to it.
    Anything you had on the new phone is gone.

  • Oracle.jbo.domain.Number to int and back

    I have a database field that comes back as a oracle.jbo.domain.Number.
    I want to increment this by one so was trying to convert it to an int, apply the increment then turn it back into a number.
    2 questions :
    1) Can I increment oracle.jbo.domain.Number directly
    2) If not how to I turn it to an int and back
    Many thanks,
    Richard

    Convert oracle.jbo.domain.Number to int with the intValue method.
    oracle.jbo.domain.Number var;
    int intValue=var.intValue();Convert int to oracle.jbo.domain.Number with the Number (int value) constructor.
    int intValue;
    oracle.jbo.domain.Number var=new oracle.jbo.domain.Number(intValue);

  • Imageicon created from byte array gives -1 height and -1 width...

    Hi,
    when I am trying to create an imageicon object from byte arrays the length and width of the object are coming to be -1.So I am unable to resize the image..
    This is happening for only few images, most of them are working fine and I can resize it...
    What possibly could be wrong??
    ImageIcon imageIcon = new ImageIcon(pImageData) where pImageData is bytearray..
    but I am getting imageIcon.getIconWidth()=-1
    and
    imageIcon.getIconHeight()=-1
    Can anyone help???

    es5f2000 wrote:
    I'm not sure if this is related, but I believe that images which are not currently being rendered return -1, -1 as their size.It is not even correct, so I'm confident it is not related.
    import java.awt.Image;
    import javax.swing.ImageIcon;
    import javax.imageio.ImageIO;
    import java.net.URL;
    class TestIconSize {
         public static void main(String[] args) throws Exception {
              Image image = ImageIO.read( new URL(
                   "http://forums.sun.com/im/silver-star.gif") );
              ImageIcon imageIcon = new ImageIcon( image );
              System.out.println( "Width: " + imageIcon.getIconWidth() );
              System.out.println( "Height: " + imageIcon.getIconHeight() );
    }Output.
    andrew@pc1:/media/disk/projects/numbered/all$ java TestIconSize
    Width: 16
    Height: 16
    andrew@pc1:/media/disk/projects/numbered/all$ The post after yours seems of even more dubious quality. For those (and other) reasons, I second Darryl's call for an SSCCE.

  • Sending audio from logic to external hardware effects, and back into Logic

    Hi,
    I am currently trying to send audio from Logic to external hardware effects and then record this back into Logic.
    My audio interface is a Edirol UA-25 which has only two outputs '1 and 2'.
    I understand that I could create an 'aggregate device' which would create two more ins + outs being '3 & 4'.
    I also understand that would need to use the Logic I/O plug in configuring this routing.
    When treating the audio via the external hardware I particularly only want to hear the audio being processed and not the original 'uneffected' signal.
    Can someone please explain if I am able to do all of this with just the UA-25, and if so, then how.
    Cheers,
    Mr Rock

    You connect output 1 of your interface to your active speaker.
    You connect output 2 of your interface to the input of your external effect.
    You connect the output of your external effect to input 2 of your interface.
    You route your track in Logic to output 2.
    You create a new track.
    You route this new track to output 1 and output 1 only.
    You choose input 2 as the source for this track.
    You arm the track.
    You hit Record.
    You hit Stop some time later.
    Christian

  • Is it possible to have two USB drives for the IPad?  I want to bring RAW photo files from my camera, through the IPad and back to an external hard drive.  One of my cameras does not use an SD card.  How can I do this?

    Is it possible to have two USB drives for the IPad?  I want to bring RAW files from my camera through the IPad and out to an external hard drive.  One of my cameras has an SD card but the other one doesn't have a card that would fit in any of the camera devices I've seen on line.  Realted to this, I bought the IPad camera accessory.  Can I put the SD card in the device and also hook the external hard drive to the USB port of the accessory and download from the camera to the hard drive?  Can I put Lightroom or the Nikon photo editing software on the IPad?  Right now I carry a PC laptop and external hard drives with me on wildernes trips.  Internet and WiFi are not available.  Because I shoot so many photos and they're in RAW I need to download from the camera to the external drive because I run out of memory on the PC (and it has much more memory than the IPad).  I have Nikon NX software and lightroom on my PC.  I'd love to be able to reduce the weight I carry by using the IPad to edit my photos each night while on trips.  Is this possible and how would I do it?  I'd appreciate any guidance.

    No, the camera connection kit only supports the copying of photos and videos to the Photos app, it doesn't support copying content off the iPad. For your second camera instead of the SD reader part of the kit, does the iPad to camera cable not work with it for direct transfer to the iPad ?
    For Lightroom and Nikon software again no - you can only install apps that are available in the iTunes app store on your computer and the App Store app on the iPad, 'normal' PC and Mac (OS X) software are not compatible with the iPad (iOS). There are some apps that perform fairly basic editing functions that are available in the store, but nothing as sophisticated as, for example, Lightroom.

  • After exporting an image from Lightroom CC to PS CC and back to LR CC

    When doing adjustments on the image, the screen blanks out after each adjustment. I have a fully loaded Macbook Pro (mid-2014). I unchecked the Graphics Processor. Makes no difference. On or Off.  Any suggestions? Very annoying. Thanks

    YES SIR!!!
    The Computer specs:
    Dell XPS (Windows 8)
    Intel Core i7-4500U @ 1.80GHz  2.40GHz
    8 GB RAM
    64 Bit
    Im exporting Mpeg Video and Audio (.mpa) for DVD. The computer it worked on before was the same exact computer. (Business PCs)
    The sofware is Premiere Pro CC and Media Encoder CC (as stated)
    Anything else?

  • Creating a sound from an array of numeric values and playing it on speakers

    How do I create take a sound I have stored as an array (or could be an arraylist if needed) of numeric values (at the moment as doubles) whiten my program and output it to speakers? I am using blueJ.
    for example (0, 0.1, 0.4, 0.8, 0.9, 1, 0.8, 0.6, 0.3, 0.1, etc...) would be a very high frequency sin wave.
    Edited by: alan2here on Feb 6, 2008 11:28 AM

    I stumbled upon this thread with a question somewhat related:
    I've recorded a wave file from microphone. But what I would like is an array of numbers in the same way alan said. I'm also working on my own project involving signal processing (i'm trying to do speech recognition).
    I can't really find a nice way of getting that array of numbers. I've tried to find out how wave file stores it's data, and directly read from the File object, but i figured there should be an easier way...
    I used this code to read the sound:
    *     SimpleAudioRecorder.java
    *     This file is part of jsresources.org
    * Copyright (c) 1999 - 2003 by Matthias Pfisterer
    * All rights reserved.
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    * - Redistributions of source code must retain the above copyright notice,
    *   this list of conditions and the following disclaimer.
    * - Redistributions in binary form must reproduce the above copyright
    *   notice, this list of conditions and the following disclaimer in the
    *   documentation and/or other materials provided with the distribution.
    |<---            this code is formatted to fit into 80 columns             --->|
    import java.io.IOException;
    import java.io.File;
    import javax.sound.sampled.DataLine;
    import javax.sound.sampled.TargetDataLine;
    import javax.sound.sampled.AudioFormat;
    import javax.sound.sampled.AudioSystem;
    import javax.sound.sampled.AudioInputStream;
    import javax.sound.sampled.LineUnavailableException;
    import javax.sound.sampled.AudioFileFormat;
    public class SimpleAudioRecorder
    extends Thread
         private TargetDataLine          m_line;
         private AudioFileFormat.Type     m_targetType;
         private AudioInputStream     m_audioInputStream;
         private File               m_outputFile;
         public SimpleAudioRecorder(TargetDataLine line,
                             AudioFileFormat.Type targetType,
                             File file)
              m_line = line;
              m_audioInputStream = new AudioInputStream(line);
              m_targetType = targetType;
              m_outputFile = file;
         /** Starts the recording.
             To accomplish this, (i) the line is started and (ii) the
             thread is started.
         public void start()
              /* Starting the TargetDataLine. It tells the line that
                 we now want to read data from it. If this method
                 isn't called, we won't
                 be able to read data from the line at all.
              m_line.start();
              /* Starting the thread. This call results in the
                 method 'run()' (see below) being called. There, the
                 data is actually read from the line.
              super.start();
         /** Stops the recording.
             Note that stopping the thread explicitely is not necessary. Once
             no more data can be read from the TargetDataLine, no more data
             be read from our AudioInputStream. And if there is no more
             data from the AudioInputStream, the method 'AudioSystem.write()'
             (called in 'run()' returns. Returning from 'AudioSystem.write()'
             is followed by returning from 'run()', and thus, the thread
             is terminated automatically.
             It's not a good idea to call this method just 'stop()'
             because stop() is a (deprecated) method of the class 'Thread'.
             And we don't want to override this method.
         public void stopRecording()
              m_line.stop();
              m_line.close();
         /** Main working method.
             You may be surprised that here, just 'AudioSystem.write()' is
             called. But internally, it works like this: AudioSystem.write()
             contains a loop that is trying to read from the passed
             AudioInputStream. Since we have a special AudioInputStream
             that gets its data from a TargetDataLine, reading from the
             AudioInputStream leads to reading from the TargetDataLine. The
             data read this way is then written to the passed File. Before
             writing of audio data starts, a header is written according
             to the desired audio file type. Reading continues untill no
             more data can be read from the AudioInputStream. In our case,
             this happens if no more data can be read from the TargetDataLine.
             This, in turn, happens if the TargetDataLine is stopped or closed
             (which implies stopping). (Also see the comment above.) Then,
             the file is closed and 'AudioSystem.write()' returns.
         public void run()
                   try
                        AudioSystem.write(
                             m_audioInputStream,
                             m_targetType,
                             m_outputFile);
                   catch (IOException e)
                        e.printStackTrace();
         public static void main(String[] args)
              if (args.length != 1 || args[0].equals("-h"))
                   printUsageAndExit();
              /* We have made shure that there is only one command line
                 argument. This is taken as the filename of the soundfile
                 to store to.
              String     strFilename = args[0];
              File     outputFile = new File(strFilename);
              /* For simplicity, the audio data format used for recording
                 is hardcoded here. We use PCM 44.1 kHz, 16 bit signed,
                 stereo.
              AudioFormat     audioFormat = new AudioFormat(
                   AudioFormat.Encoding.PCM_SIGNED,
                   44100.0F, 16, 2, 4, 44100.0F, false);
              /* Now, we are trying to get a TargetDataLine. The
                 TargetDataLine is used later to read audio data from it.
                 If requesting the line was successful, we are opening
                 it (important!).
              DataLine.Info     info = new DataLine.Info(TargetDataLine.class, audioFormat);
              TargetDataLine     targetDataLine = null;
              try
                   targetDataLine = (TargetDataLine) AudioSystem.getLine(info);
                   targetDataLine.open(audioFormat);
              catch (LineUnavailableException e)
                   out("unable to get a recording line");
                   e.printStackTrace();
                   System.exit(1);
              /* Again for simplicity, we've hardcoded the audio file
                 type, too.
              AudioFileFormat.Type     targetType = AudioFileFormat.Type.WAVE;
              /* Now, we are creating an SimpleAudioRecorder object. It
                 contains the logic of starting and stopping the
                 recording, reading audio data from the TargetDataLine
                 and writing the data to a file.
              SimpleAudioRecorder     recorder = new SimpleAudioRecorder(
                   targetDataLine,
                   targetType,
                   outputFile);
              /* We are waiting for the user to press ENTER to
                 start the recording. (You might find it
                 inconvenient if recording starts immediately.)
              out("Press ENTER to start the recording.");
              try
                   System.in.read();
              catch (IOException e)
                   e.printStackTrace();
              /* Here, the recording is actually started.
              recorder.start();
              out("Recording...");
              /* And now, we are waiting again for the user to press ENTER,
                 this time to signal that the recording should be stopped.
              out("Press ENTER to stop the recording.");
              try
                   System.in.read();
              catch (IOException e)
                   e.printStackTrace();
              /* Here, the recording is actually stopped.
              recorder.stopRecording();
              out("Recording stopped.");
         private static void printUsageAndExit()
              out("SimpleAudioRecorder: usage:");
              out("\tjava SimpleAudioRecorder -h");
              out("\tjava SimpleAudioRecorder <audiofile>");
              System.exit(0);
         private static void out(String strMessage)
              System.out.println(strMessage);
    }Daniel

  • Jump from Sales Order to Purchase Order and back again (all in change mode)

    Hi,
    Situation is this:
      - Sales Order is created with 10 items. 4 items are created with connection to Purchase Order.
      - User open Sales Order in change mode
      - User goes to item 20 that has a related Purchase Order
      - User wants to jump to related Purchase Order and make an update here
      - User wants to be able to jump back to Sales Order Item 20 from Purchase Order
    When user jumps to Purchase Order in change mode, then this Purchase Order will also block the same Sales Order, that was open. This can be handled with dequeue and enqueue.
    Problem is that when Purchase Order is saved it will make an update to the Sales Order in the background. When user jumps back to Sales Order then this Sales Order is still open with old data and these data does not reflect data that can have been updated by the Purchase Order.
    Also: When Purchase Order is making updates to the Sales Order then e.g. Message Out Table NAST is automatically updated (insert and delete records). If user then manually updates the Sales Order with old information, then System Dump appears as Sales Order tries to insert NAST records, that have already been inserted or delete NAST records that have already been deleted via the Purchase Order.
    This means that when user jumps back from Purchase Order to Sales Order Item 20 then Sales Order needs to be refreshed with new data after Purchase Order has saved the Sales Order.
    Are there any solution to do this in a standard way (from within SAPMV45A) ?  
    I prefer not to reopen Sales Order using syntax like CALL TRANSACTION.

    Hi,
    Thanks for reply.
    In third party PR gets created automatically but PO gets create manually.So changes get refelect in PR only not in PO.
    Can you give me the solution for completing this task.
    Thanks & Regards
    Jalaj garg

  • Grabbing numbers from an array of type double and outputting them into a text file

    In a program im creating i need to save some coordinates of a micropositioner i have into a text file,
    I have the coordinates saved into an array that has 6 digits of precision (6 places after the decimal point).
    I use the number to string conversion and wire that into the write to text file function in labview.  When i open the file
    the numbers that are only displayed are the ones to the left of the decimal point.  I know the number to decimal string function
    rounds the values so if i were to input 3.111111 it would only output the string "3" instead of "3.111111" . 
    So to get all the digits onto the file without rounding i multiplied the number by 10^6 but the decimal point will be lost at that point.
    Is there anyway i can convert numbers into strings without labview rounding to the nearest whole number also without having to multiply by 10^6 and without having to expect the user to know that the coordinates saved in a file are multiplied by an order of magnitude of a million ? 

    ed oh i guess i just missed that function on the pallete after i saw that the function went from number to hex, octal, etc. i assumed that the rest on that row would be some sort of conversion to a different base number, haha thanks.

  • After a recent restore on my iphone i left the wireless network whilst it was backing up from icloud, when i got home and back on wireless all my apps etc continued downloading but only 6 photos, can i retrieve these from icloud?

    Can i go back to an icloud back up before i lost my photos? I have tried yesterday 10/09/2012 but when restarting my phone from icloud the earliest backup it would let me select was 8/09/2012, it was about a week before this when i lost my photos and videos.

    Do you even have an iCloud backup to restore from?
    http://support.apple.com/kb/HT4859
    If not, there is nothing to restore from.

  • From FCP to Photoshop CS3 Ext. and back

    I want to use an adjustment layer in PS on a clip from my timeline. What's the best way to get it out of FC in a useable form, then pop it back in when done?
    Thanks!
    dc

    For output, I would spit out a reference movie. PS seems to open them fine. That way there is no extra compression going out. So, in FCP, go to File > Export > Quicktime Movie. In the resulting pop-up window, make sure "Make Movie Self-Contained" is not checked. Now you have a reference to your original media without transcoding and taking a quality hit. PS should open this movie up fine - does for me, using a ProRes HQ reference movie.
    Then, coming back out of PS, I'd just use the setting that matches the destination sequence in FCP.

  • Problem transferring Itunes from iPod to New Dell,  iTunes and back to iPod

    Hello - yesterday I uploaded my iTunes library to new Dell Inspiron Windows Vista successfully by "Transferring Purchases from iPod" back into iTunes;
    I am unable to download the "New" library back to my iPod now. I am able to purchase from iTunes and see/listen via computer new iTunes songs, but not able to re-download library to iPod Nano. Any suggestions?
    Thanks in advance!

    Since you have a Mac you can use a program called Senuti. It transfers all your material from your iPod to your computer. Download Senuti, then in the preferences, set your destination folder to the iTunes music folder. All the content on your iPod will be placed in there and then all you have to do is transfer that to your new iTunes library. Hope it works out.
    http://www.macupdate.com/info.php/id/14982

  • From External Hard Drive to Itunes and back...

    Hello I have a external hard drive with 2 main folders Music 1 Music 2, each folder has about 6-8 sub-folders labeled with the genres am in to , and those sub-folders have the artist I believe correspond to  that genres, to many artist with genres was a mess on my PC so I figured this was the easiest solution for me.
    Still with me? Ok, Great Here is part one of my first question, How can I guide Itunes to my E.H.D music folders and telling it; here is my music, Fix it with albums and correct file name just don’t copy in to my Mac Hard Drive and take the 90 GB space your taking on my E.H.D. Second part do I need to prepare the music folders in any way, meaning can I leave it the way I have it set up or do I just put all the music, no labels just as is on main Folder and let Itunes label it and set it up the way I tell it  to on ITunes.
    Second question, since this has taken nearly a day and a half trying to find the answer, till I finally decided to ask. Should I just put all the music with out sub-folders on my E.H.D. on one main folder and transfer the 90 GB to my IMac H.D. and Itunes, correct everything on ITunes and let it label it the way ITunes, ipod, and Ipad, can read it with no problems of missing files or artwork. Then when that is done I can transfer it back to the E.H.D. and save it again, the ITunes way.  If this is the best way then, I still need to figure out how to tell ITunes the music is here and perfectly labels and in its corresponding Sub-folders use it but dont take it to the IMac H.D(or something is getting back handed real quick). Hope this explains my frustration or am just over thinking it to much and making it harder for my self . again thanks for all the help.

    Have a look at these 2 Videos...
    http://macmost.com/moving-your-itunes-library.html
    http://macmost.com/moving-your-itunes-media-to-an-external-drive.html

Maybe you are looking for