String to Byte convertion related question. SMS related

Hi all
I need to ask more indepth question regarding string to bytes convertion. I need to have a constructed message format with a length of 161 bytes. Here's are the details:-
String message - 160 bytes allocation.
Message length - 1 byte allocation.
For converting the message string into byte I can use
byte b1[] = message.getBytes();
And i know to get the length of the message I can just use
message.length();
So my questions are :-
1) I need some help on how i'm supposed to convert the length message values and assign it into the message length variables which have 1 byte allocation.
2) Besides text, the message string can also be a hex value data. Hence it it possible that I can convert the hex data into byte and still maintain within the 160 bytes allocation ? Coz most of the times the hex data length will be > 160 but < 255 characters length. example :-
06050415810000024a3a7d35bd35bdb995e535bd41c9bd89b194040082986417614819817624e3105d85206605e09390391394417817817819817824e40e44e5104a04a04a05205105d85206605d8938c417614819817824e40e44e5105e05e05e06605e093903913944128128128148146800
Anyone can help ?
Thank You in Advanced

First of all. One character in a string can occupie
more than one byte in the destination array, so
String.length can be != bytes.length.
A byte in java is always signed, so the value will be
in the range -128 to +127.
KajHi Kaj,
Since you put it in that way, is there any tips u can give me on how I'm supposed to calculate the length of the string and set the value in byte ?
Or do I need to convert the string into bytes array first and then get the length ?
Thanks

Similar Messages

  • I want to check all functions of PCI 6534.I have read the user manual..I have some memory related questions.​Please help me for that.

    I want to check all functions of PCI 6534.I have read the user manual..I have some memory related questions.Please help me for that.
    1.)If i am using the continuous output mode.and the size of generated data is less than 32 MB.If i want to preload the memory,what should i do?I want that first of all i load all my data to onboard memory & then i want to make start the transfer between 6534 & peripheral.Is it possible?As per me it should be.Plz tell me how should i do this?I think that in normal procedure the transfer between 6534-peripheral & outputting data from pc buffer to onboard memory works parallely.But i don't want this.Is it poss
    ible?
    (2).Similarly in finite input operation(pattern I/O) is it possible to preload the memory and then i read it?Because i think that the PC memory will be loaded automatically when 6534 acquires the data and then when we use DIO read vi the pc buffer data will be transferred to application buffer.If this is true,i do not want this.Is it possible?
    (3) One more question is there if i am using normal operation onboard memory will be used bydefault right?Now if i want to use DMA and if i have data of 512 bytes to acquire.How will it work and how should i do it?Please tell me the sequence of operations.As per my knowledge in normal DMA operation we have 32 Bytes FIFO is there so after acquisition of 32 bytes only i can read it.How it will known to me that 32 bytes acquisition is complete?Next,If i want to acquire each byte separately using DMA interrupts what should i do?Provide me the name of sourse from which i can get details about onboard memory & DMA process of 6534 specifically
    (4).In 6534 pattern Input mode,if i want to but only 10 bits of data.and i don't want to waste any data line what should i do?

    Hi Vishal,
    I'll try to answer your questions as best I can.
    1) It is definitely possible to preload data to the 32MB memory (per group) and start the acquisition after you have preloaded the memory. There are example programs on ni.com/support under Example Code for pattern generation and the 6534 that demonstrate which functions to use for this. Also, if your PC memory buffer is less than 32MB, it will automatically be loaded to the card. If you are in continuous mode however, you can choose to loop using the on-board memory or you can constantly be reading the PC memory buffer as you update it with your application environment.
    2) Yes, your data will automatically be loaded into the card's onboard memory. It will however be transferred as quickly as possible to the DMA FIFO on the card and then transferred to the PC memory buffer through DMA. It is not going to wait until the whole onboard memory is filled before it transfers. It will transfer throughout the acquisition process.
    3) Vishal, searching the example programs will give you many of the details of programming this type of application. I don't know you application software so I can't give you the exact functions but it is easiest to look at the examples on the net (or the shipping examples with your software). Now if you are acquiring 512 bytes of data, you will start to fill your onboard memory and at the same time, data will be sent to the DMA FIFO. When the FIFO is ready to send data to the PC memory buffer, it will (the exact algorithm is dependent on many things regarding how large the DMA packet is etc.).
    4) If I understand you correctly, you want to know if you waste the other 6 bits if you only need to acquire on 10 lines. The answer to this is Yes. Although you are only acquiring 10 bits, it is acquired as a complete word (16bits) and packed and sent using DMA. You application software (NI-DAQ driver) will filter out the last 6 bits of non-data.
    Hope that answers your questions. Once again, the example code on the NI site is a great place to start this type of project. Have a good day.
    Ron

  • Converting String to byte array

    Hi,
    There is a code for converting String to byte array, as follows:
         public byte[] toByteArray(String s)
              char[] c = s.toCharArray();
              int len = c.length;
              byte[] b = new byte[len * 2];
    for ( int i = 0 ; i < len ; i++ )
         b[i * 2] = (byte)(c);
         b[(i * 2) + 1] = (byte)(c[i] >> 8);
    return b;
    But this isn't doing the conversion properly. For example, for the � (euro) symbol, it converts to some other unreadable symbol. Also, same is the case for square brackets. Any idea why this' so? What's wrong with the above code?
    The encoding format is UTF-8.
    Thanks.

    > In fact, I tried with String.getBytes() too, but leads to the same problem, with those specific symbols.
    Did you try the String.getBytes(String charsetName) method?
    Both methods have been around since Java 1.1.
    It's an extremely important skill to learn to read the API and become familiar with the tools you will use to program Java. Java has an extensive set of online documentation that you can even download for your convenience. These "javadocs" are indexed and categorized so you can quickly look up any class or method. Take the time to consult this resource whenever you have a question - you'll find they typically contain very detailed descriptions and possibly some code examples.
    Java� API Specifications
    Java� 1.5 JDK Javadocs
    Best of luck!
    ~

  • Questions in relation to iPod nano

    Hi,
    I have a few questions in relation the 5th generation iPod nano and I was hoping to find answers to them here.
    *Voice Memo*
    1. Are there any limitations imposed on the nano's voice memo functionality?
    For instance, does the nano record up to a predetermined number of minutes (say 30 minutes) or until the recording's file size reaches a particular threshold (say 100 MB)?
    Is this the case or are you only limited by how much free space you have on the device?
    2. Have people found the built-in mic to be a decent one or have they found themselves needing to purchase an external accessory to enhance the recording's audio quality.
    Radio
    This might be a silly questions, but Apple's website states that the latest nano has a built-in FM antenna. Does that mean you cannot get AM radio stations on the device?
    Thanks,
    Message was edited by: Infinite Lupe

    Hello Infinite Lupe,
    1. Are there any limitations imposed on the nano's voice memo functionality?
    Yes. Once the recording has reached the two mark the iPod automatically starts a new recording that again will go for two hours. However, this is limited as well to the amount of space remaining on your iPod as well. For more information see pages 74 - 76 of the iPod's *User Guide* which I provided below.
    2. Have people found the built-in mic to be a decent one or have they found themselves needing to purchase an external accessory to enhance the recording's audio quality.
    From my experiences the built-in microphone does just fine whether its being used for recording voice memos or videos.
    This might be a silly questions, but Apple's website states that the latest nano has a built-in FM antenna. Does that mean you cannot get AM radio stations on the device?
    Correct.
    For more information, see the iPod's User Guide.
    [iPod Nano 5th Generation User Guide|http://manuals.info.apple.com/enUS/iPod_nano_5th_genUserGuide.pdf]
    B-rock

  • HT5557 hello...my questions is related to objective C...Is it possible to display name of the person who is calling me whose number is saved in my local database but not in iphone contacts ?.

    hello...my questions is related to objective C..
    Is it possible to display name of the person who is calling me whose number is saved in my local database but not in iphone contacts ?.

    ashish35,
    No one from Apple here - we're just users like you. All I can tell you is that electronic fail and with MacBook Pros (and most notebooks) the components are so integrated as to make a repair to the logic board practically impossible, hence the high prices charged for repairs.
    Only you can decide if you want to have your computer repaired or put the money towards the purchase of a new computer. If you do decide to purchase a new unit I would suggest that you also purchase the AppleCare Protection Plan which increases your warranty from one year to three years.
    Sorry and good luck,
    Clinton

  • In which Board we need to post cRIO related Questions?

    sir,
         In which board do i need to post cRIO related Questions and doubts regarding my application with cRIO .Please help me previously i have posted in  motion control drives as my application is related to motor control using cRIO.bu i am not getting any reply .i couldnt find any cRIO related board in select board option.
    Solved!
    Go to Solution.

    Hi illa,
    You can post your query under the Real Time Measurement and Control
    http://forums.ni.com/t5/Real-Time-Measurement-and/bd-p/280

  • Two related questions:  ColdFusion 10/Java applications and J2EE supported servers

    I have two related questions:
    1.  CF10 and integration with Java Web applications
    We have a couple of Java applications running on JRun and interfacing with CF9 applications.  The JRun clusters were created through the JRun Admin and, apart from lack of Axis 2.0 support, have served us well for years now.  And, as would be the case, the ColdFusion9/Java/Flash application is a critical public-facing application that the business uses for bidding on projects.
    It appears that with ColdFusion 10 on Tomcat, we will not be able to run those Java applications on a Tomcat-CF10 JVM cluster.  Is this correct?  IF so, what are our options? 
    2.  J2EE Application Servers supported by Adobe for CF10
    Which of these is correct?
    A.  This URL (http://www.adobe.com/products/coldfusion-enterprise/faq.html) states "ColdFusion 10 supports IBM® WebSphere, Oracle® WebLogic, Adobe JRun, Apache Tomcat, and JBoss."
    B.  This URL (http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/products/coldfusion/pdfs/cf1 0/coldfusion10-support-matrix.pdf) states:
    "J2EE application servers: WebLogic Server 10.3, 11.1, WebSphere Application Server 7, ND 7 JBoss 5.1, 6.0, 7.1.0"
    I *think* "A" above is wrong re. support for Adobe JRun.  It does not specify a version of Apache Tomcat unless it is simply referring to the custom version the comes with CF10.
    Option "B" above shows no support of Adobe JRun or 'standard' Apache Tomcat.
    Thanks,
    Scott

    Question 1 above was answered:  "No support for Java web applications under CF10's custom version of Tomcat"
    Question 2:  No answer yet:  Is Apache Tomcat (NOT Adobe's customized version) supported for CF10 J2EE deployment?  I do not see any installation instructions on how to install CF10 on Apache Tomcat 6 or 7.
    Is anybody using Apache Tomcat as their J2EE app servers and, again, NOT Adobe's customized/limited version? 
    Thanks,
    Scott

  • Station Globals resource related question( how much it allocates / optimal size of it in system)

    Hi, 
    I have some questions StationGlobal’s oriented:
    1. Does the variables of type StationGlobal allocate equals amount of memory without reference to type?
       For example: Number/String/Boolean/Object Reference allocates equals resources:Number=String=Boolean=Object Reference=’X’ bytes)
       Or Number=’X’ bytes, String=’Y’ bytes, Boolean=’Z’ bytes?
    2. Does it make the difference if I have 10 or 100 or 1000 StationGlobals variables allocated in my system regards  - resources of my system and
        how the quantity of it influences(or not influences) to performance of system/Test execution?
    Those questions are important, because we want to know how the quantity/type of StationGlobal’s lvariables influence to overall throughput/performance of
    System (e.g. Test running).
    Thank you & Best Regards
    *I use LabVIEW 8.X & TestStand 3.5/4.0.1 versions only

    Not so strange IMHO. You might be making a mental analogy to C data structures where nothing is abstracted and you know exactly what is happening to each byte.
    However, TestStand variables are black box objects with a lot more functionality than plain C data structures. Like most such objects you create via almost any object oriented API, their exact memory usage is NOT documented.
    One reason memory usage is not documented is that we need to be free to change the implementation if necessary, which would not be possible if we make guarantees about exact memory usage. Another reason it is not documented is because in most practical cases, it is not important, and we don't want to mislead people into worrying about it.
    If you are allocating data structures of such vastness that it actually does matter, then the task manager is an appropriate and easy tool to use to view the approximate magnitude of memory used by the objects you create. This applies to most objects from most APIs, not just TestStand variables.

  • Partitions Related Questionn...

    Hi All,
    I want to move a partition from one table to another temporary table, by retaining the actual copy of the data in the initial table as well... Is it possible.... Howw,, Any documentationnn??
    What happens when we move a partition?? Does the partition goes into read-mode only automaticallyy... As when this movement is happening, is it possible to insert the data in the partition simoultaneouslyy...
    Are there anyy online documentss available through whichh i can grill more into Partitioning Conceptss... I have gone through the basic concepts of the partitioningg...
    Thanks in Advance...

    rahul12289471 wrote:
    What happens when we move a partition?? The partition contents do not move - merely the ownership. With a partition exchange, the owner of the table data is swapped with the owner of the partitioned data. So the table now owns the partition data (and indexes) and the partition owns the table's data (and indexes).
    The actual data does not move. Which is why exchanging a 1TB partition is as efficient (fast) as exchanging a 0 byte partition. And why this makes a very effective means of managing data in partition sets.
    As there is no copying/moving of data involved, you cannot "retain" a copy of the data. To make a copy means requiring I/O to read the entire partitioned data set (all 1TB if that is the case) and then duplicating that (writing 1TB of data if that is the case).
    Also keep in mind that duplicating data sets in a RDBMS is usually a silly and wrong thing to do. Relational design and relational databases are all about eliminating the need to duplicate data and then programatically maintain these duplicate data sets.
    I/O is also the slowest and thus most expensive operation on a database. Why would you want to contribute to that, slowing down the database and server, by doing totally redundant I/O by reading and writing the exact same data multiple times?

  • Deafult search engine on a new tab-this thread was closed but I have a related question. Once you put the new url in, what then? Close? When tried, did not work

    "deafult search engine on a new tab" - this thread was closed but I have a related question. [the word “default” is spelled as it on the thread] Once you put the new url in, what then? Close it? When tried, it did not work. The closest answer is noted here. Instructing to go to about:fig. Specifically, I installed the accuweather add=on and it took over my tab home page - the one that comes up when you click for a new tab. I didn't like it so I clicked the button to remove it and the page went blank. I searched to see out to restore the tab page, tired the reply at this page :
    http://support.mozilla.org/en-US/questions/753256?s=install+search+box+on+new+tabs&r=3&as=s
    But it did not work. Can some on help me? Just want to know how to make google or some page open on a new tab.
    Many thanks

    Thanks so much for your support. As I said I am not a professional, so I by chance saw a friend who is and this is what he suggested and it worked.
    We googled for an answer and found this site: http://www.guidingtech.com/8004/have-new-tab-page-open-specific-website-firefox-chrome/
    It says to Download and install Download and install''' NewTabURL''' and gives instructions on how to. Now when I open the tab it goes to my preferred search page!

  • PM/EAM related questions posted in PLM forum

    Hi,
    I was going through some of the threads available in PLM forum, but to my surprise, most of the threads posted are related to PM, which should have been posted in EAM forum. It was clearly mentioned by the moderator in one of the sticky thread [PLM-Forumsplit - Please ensure you are using the right forum|PLM-Forumsplit -  Please ensure you are using the right forum;
    Questions regarding Plant Maintenance (PM) or Customer Service (CS) are discussed in the Enterprise Asset Management (EAM) forum
    forums - posts will be moved to the right forum.
    Please ensure your are opening a new thread in the right forum
    Despite the clear instructions given my the moderator, PM related questions are still posted to PLM forum and some of the active participant of EAM forum answers these questions in PLM forum. It would be nice if those threads are moved to appropriate forum, so that the relevant informations are available under one forum, also, PLM forum should be monitored regularly and inappropriate threads are to be moved to their respective forum.
    Few PM related threads posted recently in PLM forum:
    [Change PR for External order|Change PR for External order;
    [BAPI or Function Module to Complete Maintenance calls in IP10|BAPI or Function Module to Complete Maintenance calls in IP10;
    [delete material from PM order|delete material from PM order;
    [Message no. IW056 Work center change --> default data redefined|Message no. IW056 Work center change --> default data redefined;
    [Component in Task list not reflecting in maintenance order|Component in Task list not reflecting in maintenance order;
    [Deleted functional location/equipments|Deleted functional location/equipments;
    [PM orders not listing components from material BOM|PM orders not listing components from material BOM;
    [Completion date in Maintenance Plans in IP10|Completion date in Maintenance Plans in IP10;
    I had used abuse reports for some, but numbers of such posts are many.

    I hate to say this, but I often see the same thing, and I've never been able to figure out exactly what triggers selectability vs. non-selectability, but I suspect some of it has to do with tranparency flattening in particular, and possibly text wrap in cases where that comes into play. ID optimizes the PDF it creates, I think, and that might cause text, or even images, to be broken into chunks in funny ways. It occurs to me that turning off optimzing for fast web view might help in this regard.

  • Please post documentation-related questions or comments on the

    Please post documentation-related questions or comments on the Performance Management Applications {forum:id=1318} forum     
    http://forums.oracle.com/forums/forum.jspa?forumID=1318

    I just got a call today that I reached my 300GB limit for the month.  I called and got a pretty rude response from the security and data usage department.  The guy told me in so many words that if I do not like or agree with the policy that I should feel free to find another service provider.!!! I tried to explain that we watch Netflix and XFinity on-demand alot and I was told that that can not be anywhere close to the data usage. I checked my router and watching a "super HD, dolby 5.1" TV show on Netflix will average about 5-6 GB per hour (1.6MB/s) ... sp this means that I can only watch no more than 1-2 Super HD TV shows a day via Netflix before I run out of my data usage.    This seems a bit redicilous doesn't it? Maybe the TV ads about the higher speed than the competition should be accompanied with "as long as you don't use it too often"   Not a good experience ... 

  • Where do I  post my CRM related questions

    Where do I post my CRM related questions.
    thanks
    siva
    Message was edited by:
    sivapara

    Hi Siva,
    You can select the module of CRM from the category and post your question there. You can even search for CRM and Post your question.
    Regards,
    [email protected]

  • Online Help Related Questions

    Hi
    FYI there is no longer a dedicated place on Microsoft.com for online help related questions.  
    We are told that VS General (here) is the best place for help questions.
    Note that these sites are a good place to get help on help (Microsoft and MVP presence):
    http://groups.yahoo.com/group/hatt/ -- for WinHelp & HTML Help & general help discussion
    http://tech.groups.yahoo.com/group/MSHelpViewer/ -- For HelpViewer help (VS 2010/2012 help; Windows 8 help)
    http://tech.groups.yahoo.com/group/MSHelp2/  -- For MS Help 2.x help (VS 2002/2003/2005/2008 help)
    Feel free to ask questions on this thread if you need to. At least then we can find your post. 
    You can also email the VS/MSDN help team directly -- [email protected]
    Please let them know how you feel about the lack of support for Online Help in the forums.
    Rob
    www.helpmvp.com -- Various Help resources
    Rob Chandler Help MVP www.helpwareGroup.com | mshcmigrate.helpmvp.com | hv2.helpmvp.com

    Actually, we cannot (at least anymore) directly email the team. I tried and got a reject from the mail server.  So, I'm going to post here so I can feel better knowing I said something and then I can get back to programming :-)
    Ok, I’ve been developing Windows apps since Win 3.1 (yeah, a long time) and have always admired the Microsoft attitude towards Developers and it’s desire to educate and empower R&D.
    So, I’m wondering what’s going on?  Why am I being asked to have an account to develop anything for MY own PC?  Why am I being asked for my Microsoft account password, repeatedly, when I’m just looking up documentation on UserControl or C3 keywords…
    repeatedly?  This is nothing short of annoying and it gives me pause and concern about the ecosystem.  Is the plan to lock down programmer’s capabilities, knowledge and tools?
    I’m involved in the TAP program for Windows 10 and have voiced concerns in the same category with regard to installation and deployment of Universal Apps.  Security is not a reasonable excuse.  Some of us love to program and actually
    control their PCs.  We are not planning to sell everything we write on the Windows Store.  What happened to programming something cool for your home network or just for friends?  We need, and used to have, Microsoft’s support in doing
    this sort of thing.  Documentation and tools are more important now than ever.  I’m saddened to see the direction things are heading…
    If there is a sane reason I’m being badgered to ‘log in’ to read .NET documentation every hour, please share.  If not, please consider lobbying to get things back on track.
    Thanks

  • Button, or other panel related question

    so, if any of you have read my previous topic about painting rectangles in a panel, that worked great, but now i need to mkae those rectangles components so that when someone hovers over it or clicks on it it displays information at a certain area. I know how to make listeners and how to add buttons in a panel, BUT how do I add buttons at a specific coordinate. This program graphs data on a specific scale and therefore adding a button in the approximate area using a grid layout will not be good enough. Is there anyway for me to place the the button/component/object at the extact location that I want?
    thanks in advance

    In future GUI related questions should be posted in the appropriate GUI forum (likely Swing).
    so, if any of you have read my previous topic about
    painting rectangles in a panel, that worked great,
    but now i need to mkae those rectangles components so
    that when someone hovers over it or clicks on it it
    displays information at a certain area. What?

Maybe you are looking for