Operations on very large binary numbers

Hi guys,
I'm trying to write a java class for manipulations of very large binary numbers.
I'm representing the BN internally as boolean[] (array of booleans false for 0 & true for 1).
I want to write an algorithm for the following operations :
shifLeft (boolean[] b,int n) : shifting binary number to left by n positions.preferably a circular shift .
and also the corresponding shiftRight() method.
can some one guide me on how to implement this ?
thanks.

Consider an array of ascii chars....
array =>   | |a|b|c|d|
offset = 1
len = 4In the above there are actually five spots in the
array but the offset points to the second position in
the array and the length is 4.
If I was to extract the value it would be "abcd"
because of the offset and the length.
Now a 'shift right' means that if it is "abcd" then
it should now be "abc" (because the d fell off the
end.)
I can do that like this.
array =>   | |a|b|c|d|
offset = 1
len = 3Notice in the above that nothing changed except the
length. But because the length changed if I
extracted the value I would get "abc" because the
offset is 1 and the length is three.
Notice also that there was no array copying.Are you sure shifting works like that ?
what I know about left shifting is that the 'd' should be moved left -toghether with a, b, c- and we append a 0 in place of 'd' .
from what you said the 'd' would be gone , or am I again wrong ?
it seems i still didn't get any satisfactory answer to this problem...

Similar Messages

  • Insert Large Binary Values

    Hi all.,
    I want to insert a very large binary value of about 40000 character into database table i have tried by using clob datatype and blob datatype but all my efforts where ended in vain..
    So can any one help me on this......
    Thanks In advance

    You should use the dbms_lob package.
    RTM first, then ask.

  • Very large values from accelerome​ter

    Hello,
    I did a small impact test in the lab, and recorded the acceleration. But I got very large peak numbers, like 300g, which is unreasonable. My vi has been checked by many people, seems like no problem. Does anyone have the idea why I got such big numbers?
    Thanks.
    Yuan

    It would be helpful if you describe your hardware, DAQ , (signal-conditioner with setting) , sensor
    and please post a link to the spec-sheet of the sensor and (if you have) the individual sensitivity (cal) value(s) of your sensor. (in metric if possible )
    Now read the input voltage at a high sample rate (you can use one of the example vi's ) . If you have a pulse in the diagram hit edit-make current values default, save as a new vi and post that vi.
    Greetings from Germany
    Henrik
    LV since v3.1
    “ground” is a convenient fantasy
    '˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'

  • Binary numbers to decimal numbers

    Hello, Im writing a program that changes binary numbers to decimal numbers. I seem to be having a probelm calculating the last number in the binary code and adding it to the total. Also, when I use large binary numbers the output isnt anywhere near correct. help? please? thank you

    public class binarynumbers
    public static void main (String [] args)
    int decimal=0;
    Scanner scan= new Scanner(System.in);
    System.out.print("enter binary number> ");
    String bin=scan.next();
    int zero=0;
    int one=1;
    int length=bin.length();
    int newlen=length-1;
    while (newlen>=0)
         String number = bin.substring( zero , one );
         int number1=Integer.parseInt(number);
         int squareRoot=Math.pow(2,newlen);
         decimal+=(squareRoot*number1);
         newlen--;
         zero++;
         one++;
    System.out.println("The decimal number translation is " + decimal);
    i did that but the math part isnt working and im getting a message like this
    binarynumbers.java:26: possible loss of precision
    found : double
    required: int
         int squareRoot=Math.pow(2,newlen);
    ^
    1 error

  • I need to sort very large Excel files and perform other operations.  How much faster would this be on a MacPro rather than my MacBook Pro i7, 2.6, 15R?

    I am a scientist and run my own business.  Money is tight.  I have some very large Excel files (~200MB) that I need to sort and perform logic operations on.  I currently use a MacBookPro (i7 core, 2.6GHz, 16GB 1600 MHz DDR3) and I am thinking about buying a multicore MacPro.  Some of the operations take half an hour to perform.  How much faster should I expect these operations to happen on a new MacPro?  Is there a significant speed advantage in the 6 core vs 4 core?  Practically speaking, what are the features I should look at and what is the speed bump I should expect if I go to 32GB or 64GB?  Related to this I am using a 32 bit version of Excel.  Is there a 64 bit spreadsheet that I can us on a Mac that has no limit on column and row size?

    Grant Bennet-Alder,
    It’s funny you mentioned using Activity Monitor.  I use it all the time to watch when a computation cycle is finished so I can avoid a crash.  I keep it up in the corner of my screen while I respond to email or work on a grant.  Typically the %CPU will hang at ~100% (sometimes even saying the application is not responding in red) but will almost always complete the cycle if I let it go for 30 minutes or so.  As long as I leave Excel alone while it is working it will not crash.  I had not thought of using the Activity Monitor as you suggested. Also I did not realize using a 32 bit application limited me to 4GB of memory for each application.  That is clearly a problem for this kind of work.  Is there any work around for this?   It seems like a 64-bit spreadsheet would help.  I would love to use the new 64 bit Numbers but the current version limits the number of rows and columns.  I tried it out on my MacBook Pro but my files don’t fit.
    The hatter,
    This may be the solution for me. I’m OK with assembling the unit you described (I’ve even etched my own boards) but feel very bad about needing to step away from Apple products.  When I started computing this was the sort of thing computers were designed to do.  Is there any native 64-bit spreadsheet that allows unlimited rows/columns, which will run on an Apple?  Excel is only 64-bit on their machines.
    Many thanks to both of you for your quick and on point answers!

  • Store Very Large Numbers

    Hello,
    I am trying to find some info about how to store very large numbers with like 2000 digits or even more and do calculations on them.
    Does anyone have any info or links about this ??
    Thanks.

    BigDecimal?Speaking. What can I do for you?
    :)

  • Any suggestions on calculating with very large or small numbers?

    It seems that double values are about 17 decimal places (10e17) in precision.
    Is there a way in iPhone calculations to get more precision for very large and small numbers, like 10e80 and so forth? I know that's more than the entire number of atoms in the universe, but still.
    I tried "long double" but that didn't seem to make any difference.
    Just a limitation?
    Thanks,
    doug

    Hmmm... maybe I was just having a problem with my formatted string then?
    I was using the NSString %g format, which is supposed to print in exponential notation if the number is greater than 1e4 or less than 1e-4, or something like that.
    But I was not getting anything greater exponents than 1e17 and then I was apparently getting overflows because the number were having negative mantissas.
    All the variables involved were double...
    How did you "look at" z?
    Thanks,
    doug

  • Numbers file sizes very large

    I've noticed that file sizes in Numbers are very large. I was using Excel for a long time and all the files I created were between 20-30KB. The files consisted of an Excel workbook, with 1-2 worksheets in it. The same files in Numbers are 200-300KB and if I save them over the network from another computer to my computer, they jump up to over 1MB. Any ideas on this?

    Hello
    Nothing to do with graphics items.
    An XL file as well as an AppleWorks one is a compiled document in which many components are stored in a very compact shape. One byte was sufficient in AW to represent an operand as they where aboutone hundred.
    In Numbers, everything is described in pure text with complementary delimiters.
    When a formula uses the operand "COUNTBLANK" this one appears with its 10 letters.
    In XL as well as in AW6, a date is stored as a floating number while in Numbers it's stored as the string "mercredi 23 janvier 2008 22:33:19"
    Sama thing for every attributes of every cell.
    So this results in a huge file store in XML format. To spare space, when we close a document, the XML file is packed in .gz format.
    This is the Index.xml.gz file that we may see clicking a Numbers document wit ctrl depressed and selecting the contextual menu item "Show Package's contents".
    Double click onto Index.xml.gz will unpack it.
    giving the expanded Index.xml file.
    I assumes that they are applications dedicated to XML files.
    I don't know them so I just drag and drop the XML file onto a free text editor named Bean which I find really interesting.
    Doing that, we may examine the file's contents.
    If someone knows a correct free application able to open and display correctly the XML files, I'm interested
    Yvan KOENIG (from FRANCE mercredi 23 janvier 2008 22:49:23)

  • Very Large Numbers Question

    I am a student with a question about how Java handles very large numbers. Regarding this from our teacher: "...the program produces values that
    are larger than Java can represent and the obvious way to test their size does not
    work. That means that a test that uses >= rather than < won?t work properly, and you
    will have to devise something else..." I am wondering about the semantics of that statement.
    Does Java "know" the number in order to use it in other types of mathematical expressions, or does Java "see" the value only as gibberish?
    I am waiting on a response from the teacher on whether we are allowed to use BigInteger and the like, BTW. As the given program stands, double is used. Thanks for any help understanding this issue!

    You're gonna love this one...
    package forums;
    class IntegerOverflowTesterator
      public static void main(String[] args) {
        int i = Integer.MAX_VALUE -1;
        while (i>0) {
          System.out.println("DEBUG: i="+i);
          i++;
    }You also need to handle the negative case... and that get's nasty real fast... A positive plus/times a positive may overflow, but so might a negative plus a negative.
    This is decent summary of the underlying problem http://mindprod.com/jgloss/gotchas.html#OVERFLOW.
    The POSIX specification also worth reading regarding floating point arithmetic standards... Start here http://en.wikipedia.org/wiki/POSIX I guess... and I suppose the JLS might be worth a look to http://java.sun.com/docs/books/jls/second_edition/html/typesValues.doc.html

  • Maximmum value of a sequnec and viewing very large numbers

    Hi,
    We have a table which has a column populated using a sequence - it is maintained by code in owb but growing at larger rate than expect
    e.g sequence starts at say 10000000000, would expect next row to b created with 10000000001 but large gap in between.
    Have a separate ticket raised with oracel for this as mainatined via dimesnion opertaor code.
    However, have couple of questions reagrding sequences.
    1) How large can they be
    2) If we try query numbers which over 14 digits long starts to show e in the tool we are using (pl/sql developer) Is there a way to ensure we can see the whole number (sqlplus?) and
    I'm assuming say if had number column which very large say 18 digits long joined to another table 18 digits long then no issues?
    Thanks

    1. you really should read docs.
    e.g sequence starts at say 10000000000, would expect next row to b created with 10000000001 but large gap in between.Not necessarily. Oracle Sequence guarantees uniqueness, not continuity.
    There can be gaps by design. Especially if CACHE of the sequence is big.
    Have a separate ticket raised with oracel for this as mainatined via dimesnion opertaor code.you really should read docs before creating tickets.
    However, have couple of questions reagrding sequences.
    1) How large can they be-As large as NUMBER datatype can be - 38 digits.-
    I am wrong. Doc says - 28 digits.
    2) If we try query numbers which over 14 digits long starts to show e in the tool we are using (pl/sql developer) Is there a way to ensure we can see the whole number (sqlplus?) What is printed on screen is a matter of formatting. You can choose formatting you like in SQLPlus and SQLDeveloper
    I'm assuming say if had number column which very large say 18 digits long joined to another table 18 digits long then no issues?No issues.
    Edited by: Mark Malakanov (user11181920) on Apr 10, 2013 2:06 PM

  • Compare 2 Binary Numbers

    Hi all ,
    suppose I have two arbitrary lenght binary numbers (could be very large binaries).
    exple : 1000111 & 11111110001
    is it possible to compare them using only there 0s & 1s representations.
    i.e I don't want to convert them to base 10 & compare them (probably using BigInteger).
    what I'm looking for is an algorithm that compares 1000111 & 11111110001 only using there 0s & 1s sequences.
    If this is possible how can I implement it ?
    many thanks.

    boolean equal = true;
    for(inti = ar1.length, j=ar2.lenght; i >= 0 && j
    =
    0; i--, j--) {
    if(ar1[ i ]!=ar2[j]) {
    equal = false;
    break;
    } this code will tell you if ar1 & ar2 are equal but
    won't tell you if ar1 <ar2 or ar1>ar2
    how can we tell ar1 > ar2 for exple ?oh my bad.
    well then indeed one would hav to start at the highest bit and embed the "shorter" value with 0's.
    if the representation is in a primitive, eg. long, you cant simply write a < b since java doesnt know unsigned numbers. so either you are carefull enough and only store 31 bits in an int(like leave the highest bit alone) or you check the highest bit first, and then check the remaining.

  • In Mail, one mailbox for Recovered Message (AOL) keeps showing 1 very large message that I cannot delete. How can I get rid of this recurring problem, please?

    In Mail on iMac, successfully running OS X Lion, one mailbox on My Mac for "Recovered Messages (from AOL)" keeps showing 1 very large message (more than 20 Mb) that I just cannot seem to delete. Each time I go into my In Box, the "loading" symbol spins and the message appears in the "Recovered Messages" mailbox. How can I get rid of this recurrent file, please?
    At the same time, I'm not receviving any new mails in my In Box, although, if I look at the same account on my MacBook Pro, I can indeed see the incoming mails (but on that machine I do not have the "recovery" problem).
    The help of a clear-thinking Apple fan would be greatly appreciated.
    Many thanks.
    From Ian in Paris, France

    Ian
    I worked it out.
    Unhide your hidden files ( I used a widget from http://www.apple.com/downloads/dashboard/developer/hiddenfiles.html)
    Go to your HD.
    Go to Users.
    Go to your House (home)
    there should be a hidden Library folder there (it will be transparent)
    Go to Mail in this folder
    The next folder ( for me ) is V2
    Click on that and the next one will be a whole list of your mail servers, and one folder called Mailboxes
    Click on that and there should be a folder called recovered messages (server) . mbox
    Click on that there a random numbered/lettered folder -> data
    In that data folder is a list of random numbered folders (i.e a folder called 2, one called 9 etc) and in EACH of these, another numbered folder, and then a folder called messages.
    In the messages folder delete all of the ebmx (I think that's what they were from memory, sorry I forgot as I already deleted my trash after my golden moment).
    This was GOLDEN for me. Reason being, when I went to delete my "recovered file" in mail, it would give me an error message " cannot delete 2500 files". I knew it was only 1 file so this was weird. Why 2500 files? Because if you click on the ebmx files like I did, hey presto, it turned out that they were ALL THE SAME MESSAGE = 2500 times. In each of those folders in the random numbers, in their related message folder.
    Now remember - DONT delete the folder, make sure you have gone to the message folder, found all those pesky ebmx files and deleted THOSE, not the folder.
    It worked for me. No restarting or anything. And recovered file. GONE.
    Started receiving and syncing mail again. Woohoo.
    Best wishes.

  • Profile Performanc​e and Memory shows very large 'VI Time' value

    When I run the Profile Performance and Memory tool on my project, I get very large numbers for VI Time (and Sub VIs Time and Total Time) for some VIs.  For example 1844674407370752.5.  I have selected only 'Timing statistics' and 'Timing details'.  Sometimes the numbers start with reasonable values, then when updating the display with the snapshot button they might get large and stay large.  Other VI Times remain reasonable.
    LabVIEW 2011 Version 11.0 (32-bit).  Windows 7.
    What gives?
     - les

    les,
    the number indicates some kind of overroll.... so, do you have a vi where this happens all the time? Can you share this with us?
    thanks,
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • Upload very large file to SharePoint Online

    Hi,
    I tried uploading very large files to SharePoint online via the REST API using JAVA. Uploading files with a size of ~160 mb works well, but if the filesize is between 400mb and 1,6 gb I either receive a Socket Exception (Connection reset by peer) or an error
    of SharePoint telling me "the security validation for the page is invalid". 
    So first of all I want to ask you, how to work around the security validation error. As far as I understand the token, which I have added to my X-RequestDigest header of the http post request seems to be expired (by default it expires after 1800 seconds).
    Uploading such large files is time consuming, so I can't change the token in my header while uploading the file. How can I extend the expiration time of the token (if it is possible)? Could it help to send post requests with the same token
    continuously while uploading the file and therefore prevent the token from expiration? Is there any other strategy to upload such large files which need much more than 1800 seconds for upload?
    Additionally any thoughts on the socket exception? It happens quite sporadically. So sometimes it happens after uploading 100 mb, and the other time I have already uploaded 1 gb.
    Thanks in advance!

    Hi,
    Thanks for the reply, the reason I'm looking into this is so users can migrate there files to SharePoint online/Office 365. The max file limit is 2gb, so thought I would try and cover this.
    I've looked into that link before, and when I try and use those end points ie StartUpload I get the following response
    {"error":{"code":"-1, System.NotImplementedException","message":{"lang":"en-US","value":"The
    method or operation is not implemented."}}}
    I can only presume is that these endpoints have not been implemented yet, even though the documentation says they only available for Office 365 which is what  I am using. 
    Also, the other strange thing is that I can actually upload a file of 512mb to the server as I can see it in the web UI. The problem I am experiencing is get a response, it hangs on this line until the TimeOut is reached.
    WebResponse wresp = wreq.GetResponse();
    I've tried flushing and closing the stream, sendchunked but still no success

  • Unable to copy very large file to eSATA external HDD

    I am trying to copy a VMWare Fusion virtual machine, 57 GB, from my Macbook Pro's laptop hard drive to an external, eSATA hard drive, which is attached through an ExpressPort adapter. VMWare Fusion is not running and the external drive has lots of room. The disk utility finds no problems with either drive. I have excluded both the external disk and the folder on my laptop hard drive that contains my virtual machine from my Time Machihne backups. At about the 42 GB mark, an error message appears:
    The Finder cannot complete the operation because some data in "Windows1-Snapshot6.vmem" could not be read or written. (Error code -36)
    After I press OK to remove the dialog, the copy does not continue, and I cannot cancel the copy. I have to force-quit the Finder to make the copy dialog go away before I can attempt the copy again. I've tried rebooting between attempts, still no luck. I have tried a total of 4 times now, exact same result at the exact same place, 42 GB / 57 GB.
    Any ideas?

    Still no breakthrough from Apple. They're telling me to terminate the VMWare processes before attempting the copy, but had they actually read my description of the problem first, they would have known that I already tried this. Hopefully they'll continue to investigate.
    From a correspondence with Tim, a support representative at Apple:
    Hi Tim,
    Thank you for getting back to me, I got your message. Although it is true that at the time I ran the Capture Data program there were some VMWare-related processes running (PID's 105, 106, 107 and 108), this was not the case when the issue occurred earlier. After initially experiencing the problem, this possibility had occurred to me so I took the time to terminate all VMWare processes using the activity monitor before again attempting to copy the files, including the processes mentioned by your engineering department. I documented this in my posting to apple's forum as follows: (quote is from my post of Feb 19, 2008, 1:28pm, to the thread "Unable to copy very large file to eSATA external HDD", relevant section in >bold print<)
    Thanks for the suggestions. I have since tried this operation with 3 different drives through two different interface types. Two of the drives are identical - 3.5" 7200 RPM 1TB Western Digital WD10EACS (WD Caviar SE16) in external hard drive enclosures, and the other is a smaller USB2 100GB Western Digital WD1200U0170-001 external drive. I tried the two 1TB drives through eSATA - ExpressPort and also over USB2. I have tried the 100GB drive only over USB2 since that is the only interface on the drive. In all cases the result is the same. All 3 drives are formatted Mac OS Extended (Journaled).
    I know the files work on my laptop's hard drive. They are a VMWare virtual machine that works just fine when I use it every day. >Before attempting the copy, I shut down VMWare and terminated all VMWare processes using the Activity Monitor for good measure.< I have tried the copy operation both through the finder and through the Unix command prompt using the drive's mount point of /Volumes/jfinney-ext-3.
    Any more ideas?
    Furthermore, to prove that there were no file locks present on the affected files, I moved them to a different location on my laptop's HDD and renamed them, which would not have been possible if there had been interference from vmware-related processes. So, that's not it.
    Your suggested workaround, to compress the files before copying them to the external drive, may serve as a temporary workaround but it is not a solution. This VM will grow over time to the point where even the compressed version is larger than the 42GB maximum, and compressing and uncompressing the files will take me a lot of time for files of this size. Could you please continue to pursue this issue and identify the underlying cause?
    Thank you,
    - Jeremy

Maybe you are looking for

  • Where can I buy a Java Card programmer, reader, and some cards

    Greetings, I'm working on making some activities for a high school computer science club. I want to do things that are tangible and experiential. Specifically, I'd like to setup some Java card labs to modivate Java programming. Can anyone advise me o

  • Detection of Updating mode

    Hello everybody, We can upload Sales order using BDC, LSMW, BAPI or IDOC. Once the document no gets generated can we say by which method the document got generated ie by  using BDC, VA01, LSMW, BAPI or idoc. If yes, I want to know how. Suppose there

  • Photo folders mixed up

    I am a photographer and I have organized my photos in folders that I sync on my 4S. Funny thing happened after the OS5.1 update, when I open a photo within a folder it actually becomes another image than I hit. I do not sync with iPhoto, I have the f

  • I create files so big I can't play them?

    I just can't wrap my head around this idea. How come, when I render out a video file (and it doesn't have to be a long movie) in 1920 X 1080 - H264, I end up with a MULTI-Gigabyte file that is so large I can't play it on my Apple TV, can't even watch

  • Download Assistant does NOT have InCopy CS6 Trial

    I want to download the trial for InCopy CS6. I went to the free 30-day trial page FOR InCopyCS6, and clicked download. The download assistant downloaded onto my computer, I set up a login, and the download assistant gives me options of things to down