Adding 2 byte arrays (6 bytes each ) -any specific API available

hi friends
I m fixed up with a problem .
i want to add to arrays of six bytes each .
how can i go for this .
is there any specific API available for the same.
current method i m using is an function which add first bytes of 2 arrays and then check out if the added value is more then FF its incerments the previous bytes and then start adding the second bytes .
but its a very time consuming way .
is there any specific API available ...... to solve out this problem in a much easier way

i want to add to arrays of six bytes each .Looks like you want to add two 48bit numbers, right?
how can i go for this .
is there any specific API available for the same.No. only 8bit and 16bit number operations are supported (and theoretical 32bit operations).
current method i m using is an function which add
first bytes of 2 arrays and then check out if the
added value is more then FF its incerments the
previous bytes and then start adding the second
bytes .Sounds like the paper & pencil addition method.
but its a very time consuming way.That is a common problem when building "large number arithmetic" functions by using 8bit operations.
From my point of view the only possibility for speeding up your algorithm is using nytes instead of shorts as usually the JavaCard processors are 8bit processors and therefore short/16bit operations are already decomposed into several 8bit operations. The only problem can be that java does not have a carry bit or an number overflow error for detecting if a number gets greater than 0xFF.
Jan

Similar Messages

  • Any Telephony API available in J2ME ?????

    hi,
    anybody tell me that any telephony api available in j2me???, b'cz i want to block incomings calls using j2me...........

    yes jsr_253 is for this task. But jsr_253 is under developement or released?

  • Is there any java API available to make call to 11g Composite Service?

    Hi All,
    How can I make a call to 11g Composite from java? Is there any java client API available for this?
    Thanks,
    Vidya

    Sure there is a way.
    Here is a documentation link:
    Link: [http://download.oracle.com/docs/cd/E15523_01/integration.1111/e10224/invocapi.htm#CHDBBBBC]
    Adam

  • Is there any java api available to get the process identifier ?

    Hai,
    I am in need to get the process identifier of a running process.
    Is there any API available or any shell script which can be used in exec command
    to get it.
    Thanks in Advance.
    Kavitha M.

    Hint: Don't use the exec command! This would spawn off a new shell with a different PID. You might want to look at JNI (Java Native Interface) to attach a piece of C code to your Java application that can find out the PID.

  • Any Java API available for character recognition.. Please help

    Hi,
    I am wondering if there are any Java API for identifying the character encoding of a text content. I came across NGramJ but not enough documentation to integrate with my application. Any help would be appreciated.
    Thanks.

    I used this but the CharsetToolKit identifies only among UTF-8, UTF-16LE and UTF-16 not any other encodings like TIS-620 etc. I am new to this as well, so not sure whether I am doing it right. Please advise.
    Also, if any samples of chardet would be appreciated.
    One thing not sure, is when I send a message has Thai characters from Hotmail having my browser setting to Thai encoding(TIS-620) but my Hotmail account language is English and sent to one of my exchange accounts. In the outlook, the message looks gibbrish.
    So I need the charset encoding detector to let me know what type of encoding is done on the content (as if you choose English as the language option, the Hotmail server doesn't have charset parameter in the content-type header) so that I can decode and re-encode to UTF-8.
    Any immediate response would be appreciated.

  • Is any Public API available to create the rpd file programatically

    Hi:
    In general is there any public API's that can be used to create the rpd file programatically?
    I know that there is a discoverer migration tool to convert to rpd file is present in the latest version. But how to do it for the hyperion reports?
    Searching for any API's that may be present to create the rpd file programatically.
    Thanks & Regards
    Sridhar D

    You can use UDML to make changes to the RPD. However it is not supported by Oracle so you will be by yourself in anything goes wrong. You can also easily see the UDML code if you copy any objects from Administration tool into Notepad. This post will teach you the basics: http://oraclebizint.wordpress.com/2008/04/04/oracle-bi-ee-101332-udml-to-automate-repository-updates-migration-of-repositories-from-development-to-testproduction-environment/

  • Adding byte arrays of hex numbers

    Hi all,
    Im having a lot of trouble adding an array of bytes containg a hexidecimal number to another in java. Here is an example of what I want to do (adding 2 byte arrays of hex):
    00 00 00 FF
    00 00 00 FF
    00 00 01 FE
    Here is what I have so far:
    byte[] ary1 = new byte[]{(byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF}; byte[] ary2 = new byte[]{(byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF};
    for (int i = 0; i < ary1.length; i++) {
        ary1[i] += ary2;
    This comes out with 00 00 00 FE (using util methods to make the byte array readable as hex). Which is almost right, obviously im missing the overflow. I have no idea how I could detect this in Java, extensive googling has turned up nothing.
    Or maybe there is another simpler way to go about this?
    please help!

    Add the values into an int variable, put the result (cast to byte) into the target array and use (result >> 8) as overflow to add to the next iteration. (Possibly check that overflow at the end of the loop).

  • JVM error while reserving big byte array

    Hi all, I've encountered a strange problem while trying to unzip a big file (~100MB):
    I have to work with it in memory so I load it into byte array - this never caused any troubles until I tried to unpack a file of such big size - more detailed investigation showed that just a line like that:
    byte[] bb = new byte[100000000] - ruins a service thread WITHOUT giving an exception (so that, try-catch around it don't react on it)!
    The system config is here:
    P4 1.4GHz, 512 RAM, JDK1.5.u6
    Anyone saw such trouble?

    What was the specific error message or symptom you saw?
    Also please include which version of java you are using (the output
    from java -version).

  • How do i covert an image in J2ME into an byte array ?

    Can anyone help to show me the way to convert an image into a byte array ?
    Thanks early reply appreciated.

    Hi! I�m developing an application to be installed in two devices. My problem is that i want to send an image: I can receive it with createImage(InputStream ip), but how can i send it with OutputStream? it needs a byte array (method write), how can i convert an image into a byte array?is there any other solution? like send it as a string...
    Thanks

  • Displaying the .png image stored in an byte array

    Hi,
    I have to download an .png image from a server and i have to store it in a byte array and i have to display this byte array in another servlet. I have written the code to get the image from the remote server in a java class. The java class returns the byte array of the image and i have to display that in an servlet.
    If anybody has the code or any refrence to refer please help me..
    Thanks & Regards
    -Sandeep

    I have pasted code for servlet's doGet method which writes image data...
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws
    ServletException, IOException
    HttpSession session = request.getSession(); //taking httpsession
    response.setContentType("image/jpeg");
    ServletOutputStream out = response.getOutputStream(); //taking outputstream of response
    if (rtn.getErrorCode() == 0)
    //this will actually write image file data from where it is being called
    //byte array will contain image data, please load your image into below byte array variable
    byte[] b = new byte[100];
    out.write(b);
    out = null; //making null
    session = null; //making null
    In other servlet, write <img> tag and specify its src attribute to the "name of servlet where u have pasted above code" ..
    Regards,
    Nikhil

  • ImageIcon and byte array

    ImageIcon II = new ImageIcon( myUrl );
    Will give me an ImageIcon based upon the URL given.
    I know an alternate constructor ImageIcon II = new ImageIcon( myByteArray );
    Whereby one can get an ImageIcon based on a given ByteArray.
    Is there any way to go the other way?
    I'd like to get a byte array from a given ImageIcon.
    Any suggestions?

    The reason for the post is that I'd like to store a bunch of images (I don't know in advance how big this bunch is going to be so I'm putting the collection in an ArrayList) in one file. I can do this with a ArrayList of byte-arrays or with a Vector/ArrayList of ImageIcons.
    Will an ArrayList of byte arrays containing byte-arrays differ much in size with a ArrayList of ImageIcons? The Serilaized Form section of the API does not give me very useful information in this regard. I'm thinking putting byte arrays in the ArrayList will save me some space, but if this savings isn't very much I'm going to go ahaead and stroe a Vector/ArrayList of ImageIcons.

  • How to add byte[] array based Image to the SQL Server without using parameter

    how to add byte[] array based Image to the SQL Server without using parameter.I have a column in table with the type image in sql and i want to add image array to the sql image column like below:
    I want to add image (RESIM) to the procedur like shown above but sql accepts byte[] RESIMI like System.Drowing. I whant that  sql accepts byte [] array like sql  image type
    not using cmd.ParametersAdd() method
    here is Isle() method content

    SQL Server binary constants use a hexadecimal format:
    https://msdn.microsoft.com/en-us/library/ms179899.aspx
    You'll have to build that string from a byte array yourself:
    byte[] bytes = ...
    StringBuilder builder = new StringBuilder("0x", 2 + bytes.Length * 2);
    foreach (var b in bytes)
    builder.Append(b.ToString("X2"));
    string binhex = builder.ToString();
    That said, what you're trying to do - not using parameters - is the wrong thing to do. Not only it is insecure due to the risk of SQL injection but in the case of binary data is also inefficient since these hex strings are larger than the original byte[]
    data.

  • How to read a large file(size around 100 kbytes) into a byte array in JAVA

    aa

    But I cannot use array subscript as a long value.what do you mean?
    are you rying the following:
    long aSize = 100000;
    byte[] array = new byte[aSize];
    if this is the case, then don't do it, for your 100k file int is far more than enough.
    but in case you jsut get error while:
    byte b = array[100000];
    then it's probably because you'r array is of size 100000, that means you have bytes from 0 to 99999 in there, and 100000 is one passed the end of the array.... jus in case make your array size to be 1234567 (far more than needed for your file) and see if you still get that exception, if not, then your array was too small. but if it fixes your prob, then don't leave it as it is, try to work out the right size for array and use that....
    i wouldn't recommend using static array size, since that file might some day be bigger than you expected, and then you'd have to recompile your program.
    HTH

  • JPA: Persist binary data (byte array)

    Hi,
       when trying to add a field to an entity to hold binary data as a Byte[] (array of objects) NWDS "finds" the following error:
    Class with name '[Ljava.lang.Byte;' not found
    If the field is of type byte[] (array of primitives):
    Class with name '[B' not found
    However, according to the JEE Tutorial (page 686), byte array and Byte array are valid types. Is the JPA implementation lacking this feature or am I missing something? Here the field declaration, including the annotations:
         @Column(name="IMPL_BINARY")
         @Lob
         private byte[] implBinary;
    Thank you for your help in advance.
    Cheers,
    Patrik

    Looks like you're using JDK 6 and Eclipse/WTP has the issue described [here|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6500212]. JDK 6 is not supported as runtime yet anyway, so even if you had been able to build your project, it would not run on the server. Therefore, I'd suggest that you switch to JDK 1.5.
    HTH!
    \-- Vladimir

  • How to read an inputStream in UTF-8 into a byte array.

    Hi, Java version is 1.4.2. If inputStream.read() is used to read the bytes into a byte array, is it guarenteed that UTF-8 chars are correctly transferred into byte array? Or should we use InputStreamReader? An example would be a great help.
    Thanks in advance.

    I would like to send a byte array read from InputStream to another app where they are converted to UTF-8. In brief
    -Read input stream which comes in UTF-8 into a byte array
    -Send byte array to another app which will convert it into UTF-8 characters

Maybe you are looking for

  • Bridge crashing immediately upon launch

    Greetings, I've scoured the Web looking for an answer for this and while I've come across many possible reasons and solutions, none seem to fit the bill. I am using a Trail of CS-5 Extended (12.0.4) on a Mac Mini, OS-X Snow Leopard 10.6.7, 4GB RAM. W

  • Context mapping vs. Java beans

    Hi, I'm making a "Server" Component (Java Web Dynpro) that exposes a view to other "Client" Components (other Java Web DynPros). The Clients can insert the exposed view into their views to use the Server's services. The Server, obviously, has to be i

  • 3600 slide - battery getting very hot on charging

    Is this normal that the phone gets hot on charging. Or is it a flaw with the battery or the phone. Please advise

  • Getting Weave to work in SQL

    Hey all, I am aware this might not be the right forum, but it kinda didnt fit in anywhere else. I did run an old weave-server setup before FireFox 5, and with FF5 came the mandatory Weave-Server upgrade. The new weave server is as usual a royal pain

  • Ibook author doesn't preview from ipad nor through ibook on my mac?

    Im previewing my ibook on my ipad and also from ibook on my mac yet it create a message "can't preview" also, when im exporting my ibook it create a message "Your book couldn't be exported. Verify that your destination disk isn't full and that you ha