Getting stuck with BigInteger.toByteArray

I write code that gets data in printable hex representation, converts it to bytes and writes it down to the file (pictures in RTF are stored in this way, so to be precise, I extract pictures from RTF). And here I see the strange behaviour my string is "89504e47..." but file, converted to hex starts with "0089504e47". Could someone explain why BigInteger.toByteArray have added '0' to the byte array? I reproduced this on this simple code (identical to my app's code)
BigInteger temp = new BigInteger("89", 16);
System.out.println("byte: " + temp.toByteArray()[0]);output:
byte: 0

The javadoc for toByteArray says:
"Returns a byte array containing the two's-complement representation of this BigInteger. The byte array will be in big-endian byte-order: the most significant byte is in the zeroth element. The array will contain the minimum number of bytes required to represent this BigInteger, including at least one sign bit"
The byte that you see as zero is the one that contains the sign bit.
Kaj

Similar Messages

  • My Mac Book Pro suddenly gets stuck with weird horizontal colored lines across the screen, which will only go once I restart the laptop. What can I do?

    Randomly while scrolling, the screen just goes beserk and gets stuck with random colored lines. And, the only way to get rid of this is to restart my entire computer. My laptop is about 3 years old now. Is this a sign of age or what? What can I do to run my laptop smoothly without turning it off and on every time it goes crazy?

    Try resetting PRAM and SMC.
    Reset PRAM.  http://support.apple.com/kb/PH4405   x
    Reset SMC.     http://support.apple.com/kb/HT3964
    Choose the appropriate method.
    "Resetting SMC on portables with a battery you should not remove on your own".

  • Help I just get stuck with the blank screen and the white circle

    help I just get stuck with the blank screen and the white circle after i erase all content and setting
    i dont know how to do pls help.

    Try connecting the device to your iTunes library and restoring it.  If necessary place the iPod into recovery mode using the instructions in this Apple support document.
    iOS: Unable to update or restore
    B-rock

  • I have an hd movie on both my ipad and iPhone 5, using airplay with my iPhone 5 plays perfectly but gets stuck with my ipad 2, almost like its buffering? I just want it to play smoothly like with my iPhone. Any suggestion?

    I have an hd movie on both my ipad and iPhone 5, using airplay on my apple tv with my iPhone 5 plays perfectly but gets stuck with my ipad 2, almost like its buffering? I just want it to play smoothly like with my iPhone. Any suggestion?

    About 6 months ago I discovered iTunes was set by default to 720p. These MUST BE CHANGED TO 1080P!!!!!!!!.......So I installed FULL 1080P file on my laptop on iTunes...  When I download movies on iPhone 5s/iPad mini the file is 720p So within about 60 seconds of starting download of 1080p files into my laptop of iTunes purchases. It was at that moment that I realized it was that file my laptop has on file to sync to my Apple device...Ten minutes later when the first 1080P HD file was downloaded  I must say... The resolution is amazing... I now use this same process to install movie files from iTunes.. In FULL 1080P.. Not 720P... Works on my iPad mini also... Avatar is 5.4 GB if installed over Wi-Fi... However sync with laptop and file is 6.5 GB in size... Called Apple told them... No reply yet.... You must delete 720P files from your laptop... Look for file size in any movie purchase and you will see DOWNLOAD IN 1080P.. This will open preferences in iTunes for you to the correct tab so you can change setting to 1080p from default of 720p... DELETE any downloaded movies already downloaded into laptop... You can check file quality by right click on any movie folder and the look at movie info... Will say 720p HD... Delete to recycle bin and iCloud will appear on each movie... Now download 1080P HD file... When completed. Right click any file to verify it is 1080P HD... The sync with device...... And get ready to be upset with Apple for holding back your device for the last 2 years 3 months and 16 days......And be ready to catch your jaw from hitting the floor when you see your screen in full 1080P HD.... Apple Engineer's were asleep.....
    You will notice better pic quality... Apple by default is still sending the 720P file to the new iPhone 6 plus over wifi and sync.. howve this process above will give you full HD file for your Apple device...

  • Need to check tls/ssl but getting stuck with "You must provide a value expression on the right-hand side of the '-' operator."

    I would like to disable ssl 3 but need to test what sites only support ssl 3. I keep getting stuck with an error that is over my head. I've tried manipulating the string a dozen different ways and keep getting the same error. I am not familiar with -notin
    or how to specify which part of the property its checking: thanks a ton
    http://blog.whatsupduck.net/2014/10/checking-ssl-and-tls-versions-with-powershell.html
    line with issues:
    $ProtocolNames = [System.Security.Authentication.SslProtocols] | gm -static -MemberType Property | where-object{$_.Name -notin @("Default","None") | %{$_.Name}
    You must provide a value expression on the right-hand side of the '-' operator.
    At S:\scripts\test23.ps1:50 char:126
    + $ProtocolNames = [System.Security.Authentication.SslProtocols] | gm -static -MemberType Property | where-object{$_.Name - <<<< noti
    n @("Default","None") | %{$_.Name}
    + CategoryInfo : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : ExpectedValueExpression
    <#
    .DESCRIPTION
    Outputs the SSL protocols that the client is able to successfully use to connect to a server.
    .NOTES
    Copyright 2014 Chris Duck
    http://blog.whatsupduck.net
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
    .PARAMETER ComputerName
    The name of the remote computer to connect to.
    .PARAMETER Port
    The remote port to connect to. The default is 443.
    .EXAMPLE
    Test-SslProtocols -ComputerName "www.google.com"
    ComputerName : www.google.com
    Port : 443
    KeyLength : 2048
    SignatureAlgorithm : rsa-sha1
    Ssl2 : False
    Ssl3 : True
    Tls : True
    Tls11 : True
    Tls12 : True
    #>
    function Test-SslProtocols {
    param(
    [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,ValueFromPipeline=$true)]
    $ComputerName,
    [Parameter(ValueFromPipelineByPropertyName=$true)]
    [int]$Port = 443
    begin {
    $ProtocolNames = [System.Security.Authentication.SslProtocols] | gm -static -MemberType Property | where-object{$_.Name -notin @("Default","None") | %{$_.Name}
    process {
    $ProtocolStatus = [Ordered]@{}
    $ProtocolStatus.Add("ComputerName", $ComputerName)
    $ProtocolStatus.Add("Port", $Port)
    $ProtocolStatus.Add("KeyLength", $null)
    $ProtocolStatus.Add("SignatureAlgorithm", $null)
    $ProtocolNames | %{
    $ProtocolName = $_
    $Socket = New-Object System.Net.Sockets.Socket([System.Net.Sockets.SocketType]::Stream, [System.Net.Sockets.ProtocolType]::Tcp)
    $Socket.Connect($ComputerName, $Port)
    try {
    $NetStream = New-Object System.Net.Sockets.NetworkStream($Socket, $true)
    $SslStream = New-Object System.Net.Security.SslStream($NetStream, $true)
    $SslStream.AuthenticateAsClient($ComputerName, $null, $ProtocolName, $false )
    $RemoteCertificate = [System.Security.Cryptography.X509Certificates.X509Certificate2]$SslStream.RemoteCertificate
    $ProtocolStatus["KeyLength"] = $RemoteCertificate.PublicKey.Key.KeySize
    $ProtocolStatus["SignatureAlgorithm"] = $RemoteCertificate.PublicKey.Key.SignatureAlgorithm.Split("#")[1]
    $ProtocolStatus.Add($ProtocolName, $true)
    } catch {
    $ProtocolStatus.Add($ProtocolName, $false)
    } finally {
    $SslStream.Close()
    [PSCustomObject]$ProtocolStatus
    Test-SslProtocols -ComputerName "www.google.com"

    V2 version:
    function Test-SslProtocols {
    param(
    [Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true,
    ValueFromPipeline=$true
    )]$ComputerName,
    [Parameter(
    ValueFromPipelineByPropertyName=$true
    )][int]$Port = 443
    begin {
    $protocols=[enum]::GetNames([System.Security.Authentication.SslProtocols])|?{$_ -notmatch 'none|default'}
    process {
    foreach($protocol in $protocols){
    $ProtocolStatus = @{
    ComputerName=$ComputerName
    Port=$Port
    KeyLength=$null
    SignatureAlgorithm=$null
    Protocol=$protocol
    Active=$false
    $Socket = New-Object System.Net.Sockets.Socket('Internetwork','Stream', 'Tcp')
    $Socket.Connect($ComputerName, $Port)
    try {
    $NetStream = New-Object System.Net.Sockets.NetworkStream($Socket, $true)
    $SslStream = New-Object System.Net.Security.SslStream($NetStream, $true)
    $SslStream.AuthenticateAsClient($ComputerName, $null, $protocol, $false )
    $RemoteCertificate = [System.Security.Cryptography.X509Certificates.X509Certificate2]$SslStream.RemoteCertificate
    $protocolstatus.Active=$true
    $ProtocolStatus.KeyLength = $RemoteCertificate.PublicKey.Key.KeySize
    $ProtocolStatus.SignatureAlgorithm = $RemoteCertificate.PublicKey.Key.SignatureAlgorithm.Split("#")[1]
    catch {
    Write-Host 'Failed'
    finally {
    New-Object PsObject -Property $ProtocolStatus
    $SslStream.Close()
    Test-SslProtocols -ComputerName www.google.com
    ¯\_(ツ)_/¯

  • My ipod touch get restart by itself and just get stuck with the apple logo, What can i do?

    my ipod touch get restart by itself, and just get stuck with the apple logo, What can i do?

    Try connecting it to your iTunes library in recovery mode using the instructions in this Apple support document.
    http://support.apple.com/kb/ht1808
    Otherwise, try connecting in DFU mode.
    http://www.iclarified.com/entry/index.php?enid=1034
    B-rock

  • My Mac is doing strange things: delaying between users, mouse flickering and bouncing, gets stuck with rainbow wheel flickering. I ran the appel hardware test and it detected an error: 4MOT/4/40000003:HDD-1233 Does anybody know what that means? HELP!

    My imac is doing strange things:
    -delaying between users: when closing session it goes to blue, then takes a while to appear users signin box, and then wont recognize mouse command to enter until a couple of minutes later... then everything seems alright until....
    -it gets stuck between things, the rainbow wheel appears and its just delays there forever....
    -and every now and then the mouse starts flickering and bouncing wildly onscreen.
    I ran the appel hardware test and it detected an error:
    4MOT/4/40000003:HDD-1233
    Does anybody know what that means? HELP!

    WZZZ answered about where to get iStat. And do check the SMART status. If it is an overheating problem due to a fan or logic board problem, your hard drive is possibly cooking itself to death. If so it isn't a faulty hard drive even though the hard drive might fail. So assuming it's a temperature problem, even if you are able to repair things on the disk with software, that is working on symptoms, not causes. I could be wrong however.
    RE: AppleCare: Your iMac came with one year of AppleCare (Apple's warranty program), but within the first year you can buy 2 more years. You have to extend by the one year anniversary of purchase of the computer. Your 10,1 is too old to still be in the first year, and since you asked what it was, I'm sure you don't have it. Bottom line meaning is that whatever this problem turns out to be, you'll have to pay for it. Unless there is something like this. It is for 2011 iMacs with certain Seagate drives. You can put in your serial number for fun, but it looks like yours is too old. Lastly, some people have had Apple help them anyway if it is just out of warranty, but many have not. Your machine is one of these. Type in 10,1 in the search box. Is there an Apple Store near you? Just b/c it's out of warranty doesn't mean you shouldn't have it looked at by Apple. But no one here can say at all what Apple will or will not do.
    Hope you get it taken care of!

  • HT3226 my mail will just not open, when i try to open it it just gets stuck with the mail home page half open and when i click on the icon at the bottom it says app not responding, is there anything i can do myself or is this a trip to the Apple store?

    My mail app will not open at all, it just gets stuck half open and then when i go to the icon below it says the app is not responding, is this something i can fix myself?

    Please follow these directions to delete the Mail "sandbox" folder.
    Back up all data.
    Quit Mail.
    Triple-click the line below to select it:
    ~/Library/Containers/com.apple.mail
    Right-click or control-click the highlighted line and select
    Services ▹ Reveal
    from the contextual menu.* A Finder window should open with a folder named "com.apple.mail" selected. If it does, move the selected folder — not just its contents — to the Desktop. Leave the Finder window open for now.
    Relaunch Mail and test. If the problem is resolved, you'll have to recreate some of your Mail settings. You can then delete the folder you moved and close the Finder window. If you still have the problem, quit Mail again and put the folder back where it was, overwriting the one that may have been created in its place. Post your results.
    Caution: If you change any of the contents of the sandbox, but leave the folder itself in place, Mail may crash or not launch at all. Deleting the whole sandbox will cause it to be rebuilt automatically.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard (command-C). In the Finder, select
    Go ▹ Go to Folder...
    from the menu bar, paste into the box that opens (command-V). You won't see what you pasted because a line break is included. Press return.

  • Desperate user need help. My GPIB instrument get stuck with my labview program frequently

    Hello to all labview users,
    i am a beginner in using labview. I am currently writting a labview program to automatically control a digital control rotator HD201e and a network analyzer 8720a to work with the anechoic chamber. The program receives an initial position, amount of increment and # of steps. My program will then ask the controller to rotate to the initial position and at the meantime, the program will monitor the position of the rotator to ensure the requested position is reached. After that, at the position, the program will ask the NA to perform a reading of the measurement. Once the reading is done, the program will ask the controller to rotate to the next position and does a reading of the measurement and so on.
    My program seems to be able to perform the tasks; however, the dig.controller part seems to get stuck around 50% of the time when running the program. Sometimes, even the controller receives the requested position (can be seen from the lcd screen of the controller), the rotator just simply would not rotate; also, sometimes, the controller just simply does not respond when sending the command of moving a position, as in the debug mode (the one with a lightbulb), i see that i got "ok" on all the blocks in the writing portion ofthe program, but the controller just doesnt seem to receive the position (as seen no new position received from the lcd screen) and the cursor on the lcd screen blinks weirdly, due to that problem, my program will then get stuck in an infinite loop.....
    Usually, that problem occurs after few positions have been reached.....
    so, when that happens, i have to stop my program and re-run it. that means the program will have to re-do the measurement that were read previously....
    sometimes i have to stop and re-run my program several times to get all the measurement of all the positions done.....so...that bug renders that program to be an unefficient program.
    I have been trying to resolve that bug for weeks...but no success....i have tried to put some wait time between each block....result is not much different...
    I have also tried putting "clear" block before and after the "write" block.....same problem.....
    I have heard that the serial GPIB "flush" block may help...but i tried..but it seems the controller doesnt recognize/accept flush....
    i have also tried using the "Visa open" and "Visa close" block to see if ithat reduces the stucking thing....but seems that the controller can still get stuck....
    i have also even tried using "lock asyn" and "unlock asyn" block...but didnt seem to work....
    Has anyone experienced such problem.? Is it a known problem with some gpib instrument?
    Is there any discrepancy or bugs in my program that i am unaware of that causes this problem?
    Any advice and or opinion would be greatly appreciated....
    PS: i attached the controller part of my program and the overall program
    desperate happyguy......
    Happy guy
    ~ currently final year undergraduate in Electrical Engr. Graduating soon! Yes!
    ~ currently looking for jobs : any position related to engineering, labview, programming, tech support would be great.
    ~ humber learner of LabVIEW lvl: beginner-intermediate
    Attachments:
    HD201_Controld.jpg ‏231 KB
    AChamber_Measurements_v1d.jpg ‏857 KB
    AChamber_Measurements_v1d3.jpg ‏463 KB

    hi xseadog
    i got what you meant about the gpib reference
    actually, that final frame works because the gpib reference is already done inside that subvi.
    but my problem doesnt arise from that. most of the time ive seen, it arises between the writing frame and the while loop frame. as i mentionned, sometimes. the controller just simply doesnt rotate even i can see the requested position display on the controller lcd screen; also sometimes, just the controller is stuck without acknowledging the write position command. but in labview...while in debug mode. it is shown ok on the block.
    Happy guy
    ~ currently final year undergraduate in Electrical Engr. Graduating soon! Yes!
    ~ currently looking for jobs : any position related to engineering, labview, programming, tech support would be great.
    ~ humber learner of LabVIEW lvl: beginner-intermediate
    Attachments:
    HD-201 RPosd.jpg ‏39 KB

  • My mail account keeps getting stuck with all mails that has a attachment on it

    my mail account keeps getting stuck trying to open mails with any attachments on it. I just upgraded to lion

    Blank (lighted, but black) screen with cursor at bootup
    [SOLVED] - Macbook Air Sleep/Wake problem
    Dark screen on start-up can only see curser

  • Async call gets stuck with pending status

    Hi,
    I am working on Tasklayer where need to invoke Async. call, the .bpel file has Invoke activity and below that it has pick activity with branches one for OnMessage and another is also OnMessage but, this is for fault. Now, when it invokes the Async. what i see in the instance is that the OnMessage activity gets stuck in Pending status, it doesn't proceed further. Kindly let me know if any one has faced similar issue.
    Thanks & Regards,
    Sanjay

    Hi Sanjay,
    you are saying that u r calling an asyc process.
    So as an async process do not send the response back to parent through same port, you have to send the fault back to parent by invoking it(parent).
    Here you can send the fault by using existing callback port otherwise you can define separate port for fault can send through that(you have to do it in WSDL).
    So here for the first case no need to have the pick as u r getting both success and fault through same port. If you are going for separate one you have to have pick(one for success and other for faulted one)
    So as Steven said you have to have a catch and invoke to send the fault back to parent.
    Regards
    PavanKumar.M

  • How do I fix Calendar getting stuck with updating to iOS5?

    I have a 3rd generation iPod Touch.  I updated to iOS5 this summer, but some programs/apps got very slow, but the biggest, consistent problem is the Calendar app.  It gets stuck, it launches and the calendar is "empty" even though there are series of appt. each day.  If it does launch okay and I try to touch the + to make a new appointment, it is extremely slow, but if it does work, when I tap "done" for it to make the appointment, it gets stuck on the screen and I have to leave the program by tapping the home screen.
    How do I get the Calendar app to function smoothly, properly, and just work?
    Here's my set up:
    3rd generation iPod Touch.
    iOS 5.1.1
    In Settings -> Accounts:
    1.****@gmail.com (which then says iCloud) with Mail "off", Contacts "on" Calendars "OFF", Bookmarks "On" Notes "Off"
    2. Gmail with Mail, Calendars and Notes "ON." 
    (This was the set up from the days of iOS4, IMAP gmail/mail program via wifi, Calendar syncs via google calendar and syncs over to iCal on MacBook Pro, Notes sync wifi into Mail program notes.)
    I have tried switching Calendar Off and on again and it doesn't help, but I can try again.  I'm looking for the next level of diagnostics or means to remedy the problem.
    Thanks!

    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings      
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                 
    iOS: How to back up                                                 
    - Restore to factory settings/new iOS device.

  • HT201210 my ipad 1 gets stuck with the apple logo and doesn t work any more. any suggestions how to fix it please? when trying to restore through itunes i keep getting error 1603

    I can't restore and make my ipad work. every time i start restoring it it gets stuck and error message (1603) pops on the screen.
    Can anyone please help? Let me know what can I do to get it to work again.
    Thanks

    Check USB connections
    If there’s an issue with the USB port, cable, dock, or hub, or if the device becomes disconnected during restore, try troubleshooting the USB connection, then troubleshooting your security software.
    Common errors: 13, 14, 1600-1629, 1643-1650, 2000-2009, 4000, 4005, 4013, 4014, 4016, “invalid response”, and being prompted to restore again after a restore completes.
    To narrow down the issue, you can also change up your hardware:
    Use another USB cable.
    Plug your cable into a different USB port on your computer.
    Try a different dock connector (or no dock).
    Add (or remove) a USB hub between your device and computer.
    Connect your computer directly to your Internet source, with no routers, hubs, or switches.
    The above comes from:
    http://support.apple.com/kb/TS3694#1600

  • MBA logs-in gets to desktop screen and gets stuck with a spinning wheel...

    (I am not sure if this is the right thread for this -- MacBook Air 2009 version)
    I can turn on, boot and get to the login window (personal accounts and guest account) and when I log in I get to the desktop and get stuck there with a spinning rainbow wheel for long periods of time till I force-shut-down.
    I tried booting is Safe Mode and that seems to work perfectly. I have the computer running in Safe Mode now.
    How do I recover it to boot normally? I appreciate your helpful responses in advance!

    You have to hold down Shift after you power up your computer. Here's a detailed instruction from apple.
    http://support.apple.com/kb/ht1455
    hope that helps you... but my problem still persists.

  • Finder gets stuck with NAS

    Hi there,
    we have a rather strange issue going on: our clients (Mac Pro 2013 and older Mac Pros, as well as MacBook Pros) are connected to our Synology NAS via 10gbE. After a fresh restart on the clients we get the transfer speeds we are expecting: around 500-600MB/s read/write.
    Eventually it happens that the performance on the clients drops to 1-2Kb/s and stays that low until we restart the client. This usually happens once or twice a day. I can reproduce the stall when, for example, rendering in FCP7 to the NAS while copying a file via finder. In general it seems like too many applications are trying to send too many packets over the AFP and everything gets stuck. Like a clump in an hourglass.
    Anyone can help me troubleshoot this?
    Kind regards,
    Chris

    Try a restart.
    Do a backup, using either Time Machine or a cloning program, to ensure files/data can be recovered. Two backups are better than one.
    Try setting up another admin user account to see if the same problem continues. If Back-to-My Mac is selected in System Preferences, the Guest account will not work. The intent is to see if it is specific to one account or a system wide problem. This account can be deleted later.
    Isolating an issue by using another user account
    Try booting into the Safe Mode using your normal account.  Disconnect all peripherals except those needed for the test. Shut down the computer and then power it back up after waiting 10 seconds. Immediately after hearing the startup chime, hold down the shift key and continue to hold it until the gray Apple icon and a progress bar appear and again when you log in. The boot up is significantly slower than normal. This will reset some caches, forces a directory check, and disables all startup and login items, among other things. When you reboot normally, the initial reboot may be slower than normal. If the system operates normally, there may be 3rd party applications which are causing a problem. Try deleting/disabling the third party applications after a restart by using the application un-installer. For each disable/delete, you will need to restart if you don’t do them all at once.
    Safe Mode - Mavericks   also Yosemite
    Safe Mode - About

Maybe you are looking for

  • Queries are not getting executed in the EJB

    Hi, I am using Stateless EJB for database transactions. I have one getConnection() method in it which I am calling in every method for connection. I have created one more method in that I am executing one simple query for count(*) from one table and

  • Purchase/Material Reservation do we have standard in ESS and MSS.

    Purchase/Material Reservation do we have standard in ESS and MSS. IF we have tell me the version of ESS/MSS .

  • IDOC Create

    Hi, Im using function module to create IDOCS for Purchase Requisition update.This is done in parallel processing. My issue is some of the Purchase Requisitions are getting updated twice. That is 2 idocs are created for same Purchase Requisition updat

  • How to avoid permission prompt?

    dear friends, I created an addressbook application. i am using file to store details. on reading and writing data the application prompt Permission alert. i want to avoid this Permission prompt. If anyone know how to handle this plz guide me. guna.

  • TREX installation on IIS5.1 on Windows XP

    HI All I have installed TREX on window XP having IIS5.1 but in SAP MMC sapccmsr is not running, I search on internet that there must be Application Pools with IIS server which only come in IIS6.x , It comes with Windows 2003 server while my machine i