Simple code, but confusing

class C{
static int f1(int i) {
System.out.print(i + ",");
return 0;
public static void main (String[] args) {
int i = 0;
i = i++ + f1(i);
System.out.print(i);
}}When the above code compile and run, it give 0,1 (I am confused how?)
when it pass the value its passing as 1 then the value should remain same when it returns zero.
and it should be like i = 1 + 0;
As per my idea it should give 1,1
Can any one explain clearly how it works here ?

PrasannA@java wrote:
Hi all, thanks for the post
Finally I got it what actually happening.
If some one still not clear, can check the below link which explains in detail.
[http://www.coderanch.com/t/244938/Programmer-Certification-SCJP/post-increment-confusion]
That other thread doesn't explain much; the expression to be evaluated can be written as A+B where:
A: i++
B: f(i)
Java evaluates this expression from left to right so,
A: i++ has the value 0 while i has the value 1
B: f(i) method f will be called with the value 1 (see A)
B1: in method f the value of i is printed and 0 is returned
B2: so the value of sub-expression B is 0
Therefore the value of the entire expression is 0+0 == 0 which is printed next.
Therefore the entire output will be 1,0
kind regards,
Jos

Similar Messages

  • Ask for help( simple code but wired error )!

    The post I sent just now has some mistakes. This post is correct. My simple code is as follows:
    import java.io.*;
    import java.net.*;
    public class count {
    float dclient = (float)3.333;
    float dlan = (float)0.01884;
    float drouter = (float)0.00115;
    float doutlink = (float)0.04185;
    float dinternet = (float)1.2615;
    float dinlink = (float)3.18129;
    float client1 = 0;
    float lan1 = 0;
    float router1 = 0;
    float outlink1 = 0;
    float internet1 = 0;
    float inlink1 = 0;
    float client2 = 0;
    float lan2 = 0;
    float router2 = 0;
    float outlink2 = 0;
    float internet2 = 0;
    float inlink2 = 0;
    float x = 0;
    float z = (float)3.333;
    public static void main(String[] args) {
    for (int n=1; n<16; ++n)
    client1 = dclient;
    lan1 = dlan * (1+lan2);
    router1 = drouter;
    outlink1 = doutlink * (1+outlink2);
    internet1 = dinternet;
    inlink1 = dinlink * (1+inlink2);
    x = n / (z + client1 + lan1 + router1 + outlink1 + internet1 + inlink1);
    client2 = x * client1;
    lan2 = x * lan1;
    rounter2 = x * rounter1;
    outlink2 = x * outlink1;
    internet2 = x * internet1;
    inlink2 = x * inlink1;
    System.out.println(client1 + " " +
    lan1 + " " +
    rounter1 + " " +
    outlink1 + " " +
    internet1+ " " +
    inlink1+ " **** " +
    x + " **** " +
    client2 + " " +
    lan2 + " " +
    rounter2 + " " +
    outlink2 + " " +
    internet2+ " " +
    inlink2 + " ********************end of n = " + n + "************************"
    The compiling error is:
    count.java:43: Can't make a static reference to nonstatic variable dclient in class count.
    client1 = dclient;
    ^
    1 error
    What is wrong with it? Many thanks!

    import java.io.*;
    import java.net.*;
    public class count
         public static float dclient = (float)3.333;
         public static float dlan = (float)0.01884;
         public static float drouter = (float)0.00115;
         public static float doutlink = (float)0.04185;
         public static float dinternet = (float)1.2615;
         public static float dinlink = (float)3.18129;
         public static float client1 = 0;
         public static float lan1 = 0;
         public static float router1 = 0;
         public static float outlink1 = 0;
         public static float internet1 = 0;
         public static float inlink1 = 0;
         public static float client2 = 0;
         public static float lan2 = 0;
         public static float router2 = 0;
         public static float outlink2 = 0;
         public static float internet2 = 0;
         public static float inlink2 = 0;
         public static float x = 0;
         public static float z = (float)3.333;
         public static void main(String[] args)
              for (int n=1; n<16; ++n)
                   client1 = dclient;
                   lan1 = dlan * (1+lan2);
                   router1 = drouter;
                   outlink1 = doutlink * (1+outlink2);
                   internet1 = dinternet;
                   inlink1 = dinlink * (1+inlink2);
                   x = n / (z + client1 + lan1 + router1 + outlink1 + internet1 + inlink1);
                   client2 = x * client1;
                   lan2 = x * lan1;
                   router2 = x * router1;
                   outlink2 = x * outlink1;
                   internet2 = x * internet1;
                   inlink2 = x * inlink1;
                   System.out.println(client1 + " " +     lan1 + " " router1 " " outlink1 " " internet1 " " inlink1 " **** " +     x + " **** " +
                   client2 + " " +
                   lan2 + " " +
                   router2 + " " +
                   outlink2 + " " +
                   internet2+ " " +
                   inlink2 + " ********************end of n = " + n + "************************"

  • Editing Cells - Simple Issue, but Confused

    Simple issue, but I can't seem to figure this one out in Numbers. I'll do my best to explain in words here.
    Let's say I store the following dollar amount in cell A1 = 1264. The number is formatted to dollars. Therefore A1 is presented as $1,264.00. All is well up to this point.
    Okay, now let's assume I click out of the cell completely. Now let's say I wanted to add $250.50 to this amount in cell A1. When I go to the formula bar to add in the $250.50 it's requiring me to remove the dollar sign and comma out of my $1,264.00 number in order to complete the computation. Is this normal? I never had to do this in Excel. My thought was that I should only need to include an equal sign at the beginning of the formula (in other words, there shouldn't be a need to remove the dollar sign and comma every time, right?).
    Just wanted to make sure that I'm not missing anything overly simple (which I'm sure I am).
    Any help is greatly appreciated! I'm really enjoying my trial version of Numbers thus far.
    Message was edited by: randy.humes

    Randy,
    There is another way to remove each comma and dollar sign, one that will work on multiple cell at once if needed. Select the cells that you want to clean-up and using the Cells Inspector, change the format from Currency to Number and then click the Thousands Separator checkbox to deselect it. Then all that remains is to add the equal sign when you go in to edit the content by changing your input to a formula. Then if you still want the value to be displayed as currency, change the format back.
    I'm not saying that this method is better, but may be worth a try if your are backspace/delete averse.
    Jerry

  • Simple code, but wrong, please help.

    I wrote the follow code. When I call it in another class but no disaply. What happens? Please help me to correct it. Thanks.
    import java.awt.*;
    import java.awt.geom.*;
    import javax.swing.*;
    public class tempStr extends JApplet{
    final static Color bg = Color.white;
    final static Color fg = Color.black;
    String str;
    tempStr(String string){
         str=string;
         JFrame f = new JFrame("string draw");
            JApplet applet1 = new tempStr(str);
            f.getContentPane().add("Center", applet1);
            applet1.init();
            f.pack();
           f.setSize(new Dimension(400,400));
            f.show();
        public void init() {
            setBackground(bg);
            setForeground(fg);
    public void paint(Graphics g) {
      Graphics2D g2=(Graphics2D)g;
        g2.drawString(str, 40,160);
      }

    It would be better to move the creation code into some dedicated method:
    import java.awt.*;
    import java.awt.geom.*;
    import javax.swing.*;
    public class tempStr extends JApplet{
        final static Color bg = Color.white;
        final static Color fg = Color.black;
        String str;
        tempStr(String string){
            str=string;
        public void init() {
            setBackground(bg);
            setForeground(fg);
        public void paint(Graphics g) {
            Graphics2D g2=(Graphics2D)g;
            g2.drawString(str, 40,160);
        public static void main(String argv[]) {
            JFrame f = new JFrame("string draw");
            JApplet applet1 = new tempStr(argv[0]);
            f.getContentPane().add("Center", applet1);
            applet1.init();
            f.pack();
            f.setSize(new Dimension(400,400));
            f.show();
    }To lauch the applet from command line:
    java tempStr "Hello world"

  • What's the simple code for this?

    Hello, I know it is a very simple code but what is the code if I want to have different properties for headings and such in different id's. For example I want ID "sidebar"'s headings to be aligned in the center but I want ID "main-body"'s headings to be aligned to the left. How would I go about doing that?
    Thanks!

    CSS:
    body {
    text-align:left;
    #sidebar h1,
    #sidebar h2,
    #sidebar h3,
    #sidebar h4 {text-align:center}
    /**re-usable classes**/
    .center {text-align:center}
    .right {text-align:right}
    HTML:
    <div id="main_body">
         <h1>This is left aligned by default</h1>
         <h2 class="right">This is right aligned by virtue of the class .right.</h2>
    </div>
    Nancy O.

  • Im really confused. My ipod was giving the 13019 error message. I followed the steps, and it stopped giving me the error code but my music wont appear on my ipod. Any suggestions?

    Im really confused. My ipod was giving the 13019 error message. I followed the steps, and it stopped giving me the error code but my music wont appear on my ipod. Any suggestions? Please help

    Are you saying that the "Music" app is not present on your iPod Touch? Perhaps there is an issue with the restrictions on the iPod? If you're absolutely sure that the Music app is not present I would consider creating a backup of your iPod after syncing it with iTunes. I would then consider restoring it if this is the case.

  • XML simple code help

    Hello Everyone, I am learning XML and I'm trying to make a simple code that will display three different messages on a separate line. I already have the code but there is something that does not let it work. Please if somebody can take a quick look at the code and tell me what should I do in order to get it working. Thanks in advance
    This is my simplerequestdata.xml
    {<root>
    <message1>This</message1>
    <message2>Technology</message2>
    <message3>Is confusing</message3>
    </root>}
    This is my xmlrequest.html code
    {<html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script type="text/javascript">
    var req=null;
    function xhr(){
    try
    { // Firefox, Opera 8.0+, Safari
    req=new XMLHttpRequest();
    catch (e)
    // Internet Explorer
    try
    req=new ActiveXObject("Msxml2.XMLHTTP");
    catch (e)
    req=new ActiveXObject("Microsoft.XMLHTTP");
    return req;
    function getData(){
    req = new xhr();
    req.open("get","simpleRequestData.xml");
    req.send(null);
    if(req.readyState==4){
    if(req.status==200){
    var doc = req.responseXML;
    var msgNodes = doc.documentElement.getElementsByTagName('message');
    var msgDiv = document.getElementById("message");
    var msg = document.createElement("message");
    msg.innerHTML = msgNodes[0].firstChild.nodeValue + "<br />" + msgNodes[1].firstChild.nodeValue + '
    ' + msgNodes[2].firstChild.nodeValue;
    msgDiv.innerHTML = '';
    msgDiv.appendChild(msg);
    </script>
    <style>
    #message{color:red;}
    message{display:block;color:green;}
    </style>
    </head>
    <body>
    <form>
    <input type="button" onclick="getData()" value="Get Message"/>
    <div id="message">Message Goes Here</div>
    </form>
    </body>
    </html>
    }

    That looks like Javascript to me. This forum is about Java and XML, not Javascript and XML. However the error is pretty obvious:
    var msgNodes = doc.documentElement.getElementsByTagName('message');You don't have any elements named "message" in that XML document. You have an element named "message1" and an element named "message2" and an element named "message3", but no "message" elements. So you get a list of zero elements there. You need to rewrite your DOM-handling code to reflect the actual input.

  • "Simple" is getting confusing!

    "Simple" is the new buzzword at SAP, but I would like to know if I'm the only one getting confused with all this simplicity.
    I was watching this blog What Can SAP Simple Finance Provide Your Organization?, and I have to say right now I don't have a clear picture of what exactly is SAP's roadmap. The following confuses me:
    In that blog they say that this is supplement product, but then in the video of that same blog, the description of simplification is a technical one (less tables and code) but that the old UI will survive side by side with the new one. Is this ECC Financials with a new UI/"Data Model", or something else?
    They talk about SAP Simple Financials in the Cloud but SAP's strength was always it's tight integration with logistical modules. How does this integrate with SAP logistcs and HR? Interfaces? This doesn't seem "simple" to me;
    Will this replace SAP FI in the long run? Does this mean SAP FI is going to stand still in time with all investment going into "Simple Financials"?
    If I was a SAP customer I would be a bit worried about my investments. SAP's roadmap has always been less then clear on the peripheral components, like BI, Mobile, but this is about the core, the ECC.
    Finally I don't understand why SAP keeps using the word "Simple" since they keep having to explain that simple doesn't mean less functionality. A marketing buzzword that needs to be constantly explained ... doesn't really work.
    What are your feelings on this? Is this clear, confusing?

    As always we can trust the community to raise some interesting perspectives. Thanks Joao Souza and Gareth Ryan .  A good way to gauge/critique how the "marketing" appears to its target audience is to listen to skeptics, of course.
    Regardless of whether "simple" is a slogan or a goal, does it resonate with those who find certain domains unnecessarily complicated?  One continuous observation during my tenure with SAP web domains is how complex, confused and convoluted web destinations and presences impact the ability of various audiences to find information.  And the attraction of simple in the user experience with interfaces is fairly well documented and researched.  Would there be resistance to improving the "user experience"?
    Could it be we are attempting to improve this entry experience without diluting the power of what is inside the box?  Might it be "simplistic" to think that simple means only "dumbing down"?
    Back in the '70's the idea of "overchoice" burst on the scene with Alvin Toffler's Future Shock. And I notice that Wikipedia links this phenomena to technology development.

  • I am trying to connect my ipad to my bt home hub have put in wireless key code but still not connecting

    i am trying to connect my ipad to my bt home hub have put in wireless key code but not connecting

    Some things to try first:
    1. Turn Off your iPad. Then turn Off (disconnect power cord for 30 seconds or longer) the wireless router & then back On. Now boot your iPad. Hopefully it will see the WiFi.
    2. Go to Settings>Wi-Fi and turn Off. Then while at Settings>Wi-Fi, turn back On and chose a Network.
    3. Change the channel on your wireless router (Auto or Channel 6 is best). Instructions at http://macintoshhowto.com/advanced/how-to-get-a-good-range-on-your-wireless-netw ork.html
    4. Go into your router security settings and change from WEP to WPA with AES.
    5.  Renew IP Address: (especially if you are droping internet connection)
        •    Launch Settings app
        •    Tap on Wi-Fi
        •    Tap on the blue arrow of the Wi-Fi network that you connect to from the list
        •    In the window that opens, tap on the Renew Lease button
    6. Potential Quick Fixes When Your iPad Won’t Connect to Your Wifi Network
    http://ipadinsight.com/ipad-tips-tricks/potential-quick-fixes-when-your-ipad-won t-connect-to-your-wifi-network/
    ~~~~~~~~~~~~~~~~~~~~~~~~~
    Some things to try first:
    1. Turn Off your iPad. Then turn Off (disconnect power cord for 30 seconds or longer) the wireless router & then back On. Now boot your iPad. Hopefully it will see the WiFi.
    2. Go to Settings>Wi-Fi and turn Off. Then while at Settings>Wi-Fi, turn back On and chose a Network.
    3. Change the channel on your wireless router (Auto or Channel 6 is best). Instructions at http://macintoshhowto.com/advanced/how-to-get-a-good-range-on-your-wireless-netw ork.html
    4. Go into your router security settings and change from WEP to WPA with AES.
    5.  Renew IP Address: (especially if you are droping internet connection)
        •    Launch Settings app
        •    Tap on Wi-Fi
        •    Tap on the blue arrow of the Wi-Fi network that you connect to from the list
        •    In the window that opens, tap on the Renew Lease button
    6. Potential Quick Fixes When Your iPad Won’t Connect to Your Wifi Network
    http://ipadinsight.com/ipad-tips-tricks/potential-quick-fixes-when-your-ipad-won t-connect-to-your-wifi-network/
    ~~~~~~~~~~~~~~~~~~~~~~~~~
    Fix WiFi Issue for iOS 7
    http://ipadnerds.com/fix-wifi-issue-ios-7/
    Fix WiFi Issue for iOS 7
    http://ipadnerds.com/fix-wifi-issue-ios-7/
    iOS 6 Wifi Problems/Fixes
    Wi-Fi Fix for iOS 6
    https://discussions.apple.com/thread/4823738?tstart=240
    How To: Workaround iPad Wi-Fi Issues
    http://www.theipadfan.com/workaround-ipad-wifi-issues/
    Another Fix For iOS 6 WiFi Problems
    http://tabletcrunch.com/2012/10/27/fix-ios-6-wifi-problems-ssid/
    Wifi Doesn't Connect After Waking From Sleep - Sometimes increasing screen brightness prevents the failure to reconnect after waking from sleep. According to Apple, “If brightness is at lowest level, increase it by moving the slider to the right and set auto brightness to off.”
    Fix For iOS 6 WiFi Problems?
    http://tabletcrunch.com/2012/09/27/fix-ios-6-wifi-problems/
    Did iOS 6 Screw Your Wi-Fi? Here’s How to Fix It
    http://gizmodo.com/5944761/does-ios-6-have-a-wi+fi-bug
    How To Fix Wi-Fi Connectivity Issue After Upgrading To iOS 6
    http://www.iphonehacks.com/2012/09/fix-wi-fi-connectivity-issue-after-upgrading- to-ios-6.html
    iOS 6 iPad 3 wi-fi "connection fix" for netgear router
    http://www.youtube.com/watch?v=XsWS4ha-dn0
    Apple's iOS 6 Wi-Fi problems
    http://www.zdnet.com/apples-ios-6-wi-fi-problems-linger-on-7000004799/
    ~~~~~~~~~~~~~~~~~~~~~~~
    How to Boost Your Wi-Fi Signal
    http://ipad.about.com/od/iPad_Troubleshooting/a/How-To-Boost-Your-Wi-Fi-Signal.h tm
    Troubleshooting a Weak Wi-Fi Signal
    http://ipad.about.com/od/iPad_Troubleshooting/a/Troubleshooting-A-Weak-Wi-Fi-Sig nal.htm
    How to Fix a Poor Wi-Fi Signal on Your iPad
    http://ipad.about.com/od/iPad_Troubleshooting/a/How-To-Fix-A-Poor-Wi-Fi-Signal-O n-Your-iPad.htm
    iOS Troubleshooting Wi-Fi networks and connections  http://support.apple.com/kb/TS1398
    iPad: Issues connecting to Wi-Fi networks  http://support.apple.com/kb/ts3304
    WiFi Connecting/Troubleshooting http://www.apple.com/support/ipad/wifi/
    How to Fix: My iPad Won't Connect to WiFi
    http://ipad.about.com/od/iPad_Troubleshooting/ss/How-To-Fix-My-Ipad-Wont-Connect -To-Wi-Fi.htm
    iOS: Connecting to the Internet http://support.apple.com/kb/HT1695
    iOS: Recommended settings for Wi-Fi routers and access points  http://support.apple.com/kb/HT4199
    How to Quickly Fix iPad 3 Wi-Fi Reception Problems
    http://osxdaily.com/2012/03/21/fix-new-ipad-3-wi-fi-reception-problems/
    iPad Wi-Fi Problems: Comprehensive List of Fixes
    http://appletoolbox.com/2010/04/ipad-wi-fi-problems-comprehensive-list-of-fixes/
    Connect iPad to Wi-Fi (with troubleshooting info)
    http://thehowto.wikidot.com/wifi-connect-ipad
    Fix iPad Wifi Connection and Signal Issues  http://www.youtube.com/watch?v=uwWtIG5jUxE
    Fix Slow WiFi Issue https://discussions.apple.com/thread/2398063?start=60&tstart=0
    How To Fix iPhone, iPad, iPod Touch Wi-Fi Connectivity Issue http://tinyurl.com/7nvxbmz
    Unable to Connect After iOS Update - saw this solution on another post.
    https://discussions.apple.com/thread/4010130
    Note - When troubleshooting wifi connection problems, don't hold your iPad by hand. There have been a few reports that holding the iPad by hand, seems to attenuate the wifi signal.
    Some Wi-Fi losses may stem from a problematic interaction between Wi-Fi and cellular data connections. Numerous users have found that turning off Cellular Data in Settings gets their Wi-Fi working again.
    You may have many apps open which can possibly cause the slowdown and possibly the loss of wifi. In iOS 4-6 double tap your Home button & at the bottom of the screen you will see the icons of all open apps. Close those you are not using by pressing on an icon until all icons wiggle - then tap the minus sign. For iOS 7 users, there’s an easy way to see which apps are open in order to close them. By double-tapping the home button on your iPhone or iPad, the new multitasking feature in iOS 7 shows full page previews of all your open apps. Simply scroll horizontally to see all your apps, and close the apps with a simple flick towards the top of the screen.
    Wi-Fi or Bluetooth settings grayed out or dim
    http://support.apple.com/kb/TS1559
    ~~~~~~~~~~~~~~~
    If any of the above solutions work, please post back what solved your problem. It will help others with the same problem.
     Cheers, Tom

  • Simple SQL, but i get an error?

    Here's my code:
    <cfquery name="setNote"
    datasource="#DS#" dbtype="ODBC"
    username="#DSUsername#" password="#DSPassword#"
    >
    update Notes set note = 'test' where noteid = 1
    </cfquery>
    Seems simple enough, but I get this:
    [Macromedia][SequeLink JDBC Driver][ODBC
    Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in
    UPDATE statement.
    Yeah, I know "Access Sucks.", but this still seems like it
    should work, no?
    If I do a "select * from notes" and cfdump the results, I see
    the data that is there, I just can't update it.
    What am I missing here?

    duplicate post. answered in db access forum.
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/

  • Same code but different output on different cpu

    Hi to all,
    I realized a simple class to receive data from a tcp server.
    In the code I allocate a bytebuffer with dimension of x byte. I receive this byte from a server.
    the problem is: if I use a x86 processor class run correctly. If I use x86_64 processor a receive from the server a great value and then when the application try tu run ByteBuffer.allocate I receive a memory excedeed error.
    Why is there a different running mode if I change cpu?
    I would to attach code but in wich way I can? this forum has a limited number of words.

    I have problem at the line where is
    dati = ByteBuffer.allocate(tot_byte);
    I post you the code: sorry but it isn't optimized ....
    int numero_canali = canals.size();
            ByteBuffer packet5 = ByteBuffer.allocate(12);
            ByteBuffer packet2 = ByteBuffer.allocate(24 + 4 * numero_canali);
            packet2.putInt(0x7ABCDE0F);
            packet2.putInt(124);
            packet2.putInt(12 + 4 * numero_canali);
            packet2.putInt(0);
            for(int i = 0; i < numero_canali; i++)
                ArrayList appoggio = (ArrayList)canals.get(i);
                String s = String.valueOf(appoggio.get(3));
                int s1 = Integer.valueOf(s).intValue();
                packet2.putInt(s1);
            packet2.putInt(0);
            packet2.putInt(0);
            packet2.rewind();
            packet2.rewind();
            while(packet2.hasRemaining())
                try
                     out.write(packet2);
                catch(IOException ex)
                    ex.printStackTrace();
            do
                ByteBuffer dati = null;
                //packet.rewind();
                int total_byte;
                try
                    total_byte = in.read(packet5);
                    System.out.println ("Numero Byte letti : " + total_byte );
                catch(IOException ex)
                    ex.printStackTrace();
                packet5.rewind();
               //packet.reset();
                System.out.println((new StringBuilder()).append("Signature messaggio : ").append(Integer.toHexString(packet5.getInt())).toString());
                System.out.println((new StringBuilder()).append("Tipo Messaggio : ").append(packet5.getInt()).toString());
                int tot_byte = 0;
                tot_byte = packet5.getInt();
                //tot_byte=0;
                System.out.println("Lung mess : " + tot_byte);
                System.out.println((new StringBuilder()).append("Lunghezza del messaggio : ").append(tot_byte).toString());
                dati = ByteBuffer.allocate(tot_byte);
                dati.rewind();
                while(dati.hasRemaining())
                    try
                        in.read(dati);
                    catch(IOException ex)
                        ex.printStackTrace();
                dati.rewind();
                dati.rewind();
                byte b4 = dati.get();
                byte b3 = dati.get();
                byte b2 = dati.get();
                byte b1 = dati.get();
                long older_sequence_number = ((long)b1 & 255L) << 24 | ((long)b2 & 255L) << 16 | ((long)b3 & 255L) << 8 | (long)b4 & 255L;
                System.out.println((new StringBuilder()).append("Older Sequencial Number : ").append(older_sequence_number).toString());
                System.out.println((new StringBuilder()).append("Tipo pacchetto : ").append(dati.get()).toString());
                b4 = dati.get();
                b3 = dati.get();
                b2 = dati.get();
                b1 = dati.get();
                long seconds = ((long)b1 & 255L) << 24 | ((long)b2 & 255L) << 16 | ((long)b3 & 255L) << 8 | (long)b4 & 255L;
                System.out.println((new StringBuilder()).append("Secondi : ").append(seconds * 1000L).toString());
                Date prova = new Date(seconds * 1000L);
                System.out.println((new StringBuilder()).append("Data : ").append(prova.toString()).toString());
                long sub_second = ((long)dati.get() & 255L) << 8 | (long)dati.get() & 255L;
                System.out.println((new StringBuilder()).append("Sub second : ").append(sub_second).toString());
                b2 = dati.get();
                b1 = dati.get();
                long instrument = ((long)b1 & 255L) << 8 | (long)b2 & 255L;
                System.out.println((new StringBuilder()).append("Instrument ID : ").append(instrument).toString());
                ArrayList array_temp = new ArrayList(numero_canali);
                for(int s = 0; s < numero_canali; s++)
                    ArrayList appoggio = (ArrayList)canals.get(s);
                    boolean add = array_temp.add(appoggio.get(0));
                b4 = dati.get();
                b3 = dati.get();
                b2 = dati.get();
                b1 = dati.get();
                long sequence_number = ((long)b1 & 255L) << 24 | ((long)b2 & 255L) << 16 | ((long)b3 & 255L) << 8 | (long)b4 & 255L;
                System.out.println((new StringBuilder()).append("Sequece Number : ").append(sequence_number).toString());
                b2 = dati.get();
                b1 = dati.get();
                long payload = ((long)b1 & 255L) << 8 | (long)b2 & 255L;
                System.out.println((new StringBuilder()).append("Byte Payload : ").append(payload).toString());
                int posizione_id = array_temp.indexOf(Long.valueOf(instrument));
                System.out.println((new StringBuilder()).append("instrument \350 alla posizione : ").append(posizione_id).toString());
                ArrayList appoggio = (ArrayList)canals.get(posizione_id);
                Object set6 = appoggio.set(5, Long.valueOf(older_sequence_number));
                Object set5 = appoggio.set(6, Long.valueOf(seconds));
                Object set4 = appoggio.set(7, Long.valueOf(sequence_number));
                Object set3 = appoggio.set(8, Long.valueOf(payload));
                Object set2 = appoggio.set(9, prova.toString());
                Object set = canals.set(posizione_id, appoggio);
            } while(true);

  • I did not forget my lock code but somehow, my phone refuses to accept it and kept me locked out. Is this iOS7 bug?

    i did not forget my lock code but somehow, my phone refuses to accept it and kept me locked out. Is this iOS7 bug?

    i honestly do not know. this is really frustrating. I am a simple user who mostly just call and text..  i tried to follow the apple instructions in restoring iphones but some time during the process.. my phone restarts and loses the itunes connection symbol and displays the usual apple icon and then proceeds to opening the main page..

  • How to sort a list of strings, without methods and stuff just simple code?

    Hi
    How to sort a list of strings, without methods and stuff just simple code?
    Thanks in adavance!!

    Without methods? How are you going to all the sort code? What is the point of code?
    Collections.sort(List) will sort strings or anything that implements the Comparable interface, or you can use the sort method that takes a Comparator implemenation.
    If you want "just code", you could either get the Collections class souce and follow it to the code. But otherwise, there isn't one set of code. There are various sorting algorithms with advantages and disadvantages. Maybe you'd be better off searching for sorting algorithms and if you understand them, it should be simple to write Java implementations of them.

  • I understand code but I feel lost in AS3

    Ok guys so first sorry for posting this message which is not really RELEVANT in coding or anything but I need your help.
    I'm trying to learn AS 3 with Adobe flash CS6 and I've been at it for a week, but I tried FlashDevellop before.
    My problem is that I am COMPLETELY lost. I understand a bit of code (variables, array, conditionnals, logical operators, event handling at some extent etc...) and i litteraly (yes i did) followed EVERY tutorial that was on the first/second page of google for searches like "How to code in AS3 for flash CS6" or things like that. But i feel lost.
    Some tutorials tell you to use frames and don't even talk about classes, like everything could be done with only frames on the timeline and code in frames. Others don't even talk about classes and tell you everything can be done with code in one frame
    What I'm trying to say is that : Making games seems really fun and coding doesn't look THAT hard (I just search for fuctions or events name on the web when i'm not sure since I've just started)
    But sometimes I don't even understand what I did wrong, or what i should actually do at one point. What should i use and well yeah I have no idea.
    I'm trying to make a little flash game like Elona Shooter (http://www.kongregate.com/fr/games/noanoa/elona-shooter) but way simpler that this ofc. Just a basic for my first one.
    I'd say a bit more like this one : http://armorgames.com/play/4964/
    But Idk, at first I thought I could do it with the bit of knowledge I have and the internet but I get messed up with my classes, there are some things that I have no idea of how to do.
    Like adding sound, I actually know how to do it using frames, but i don't know how to do it using classes, and i started making the game with only classes so should I switch to frame? Or can i use both?
    If you guys have a GOOD tutorial, like one that not only explains code but how the WHOLE THING works, that'd be SO great like really.
    Once again sorry for posting this disorganised text. It's just that I don't know if it's just me having a lot of trouble with such a simple coding language, or if there's really a lot of things to take into account.
    Thanks a lot for reading if you did haha, and if you have any answer, please share .

    You should start with an "intro to programming" class.  A class that teaches the basics of programming.  You should know everything taught in this class before moving on to anything else - so you don't waste time learning these things by trial and error.
    I googled for intro to programming videos and there's a Stanford class on video (it looks like its all there).
    http://see.stanford.edu/see/lecturelist.aspx?coll=824a47e1-135f-4508-a5aa-866adcae1111  
    Here's the first video on youtube
    http://youtu.be/KkMDCCdjyW8

  • JMS Simple code in Sun tutorial

    I run a simple code (http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JMS4.html) fine in j2sdkee , but fail to use in Openjms/ JBoss.
    try {
    connectionFactory = (ConnectionFactory) jndiContext.lookup("QueueConnectionFactory");
    } catch (Exception e) {
    System.out.println("JNDI API lookup failed: " + e.toString());
    return;
    What's wrong of the above code? Why do I can the following error in Openjms / Jboss?
    JNDI API lookup failed: javax.naming.CommunicationException: Can't find

    OpenJMS by default defines the following: (QueueConnectionFactory is not defined by default!)
    queueName = "queue1"
    queueConnectionFactoryName = "JmsQueueConnectionFactory"
    The creation of the initial context could be done like this
    Hashtable env = new Hashtable ();
    env.put(Context.PROVIDER_URL,
    "rmi://localhost:1099/JndiServer");
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    "org.exolab.jms.jndi.rmi.RmiJndiInitialContextFactory");
    jndiContext = new InitialContext (env);
    Similar modifications are needed for JBoss

Maybe you are looking for

  • How to create the pricing procedure for domestic & import.

    HI,     Pls any body let me know how to create the pricing procedure for domestic & import. what is the use of the keys step condiiton condition type from   to  manual required statistic   subtotal requirement caltype basetype. how system will work b

  • Parked and Blocked Invoice

    Hi Gurus, What is the difference between parked and blocked invoice? Under what situations we go for parked invoices and under what situations for blocked invoices? When there is a quantity and price variance, invoice gets blocked. Can we go for park

  • About:config settings change by themselves when switching between windows/linux on dual-boot machine with profile shared between OSs

    I dual-boot ubuntu and windows7, and have set up firefox to use the same profile data when running under either OS. This works great, except: (1) each time I switch OSs and start firefox, it runs the "checking add-on compatibility" test (which is a m

  • Upgrade from osx 10.4.11 to osx 10.5.8

    I have new nano 16gb that requires OSX 10.5.8 .Can i go directly to 10.5.8 from 10.4 11. OR can i go directly from 10.4.11 to the most recent OSX system what ever that is. Please advise what to buy.Also can this be installed by me,is there a how to l

  • Help please HP Officejet Pro 8600 & HP Photo creations

    Hardware: iMac running OS X Yosemite latest update HP Officejet Pro 2 trays I just downloaded HP photo creations and have a layout I am trying to print on 4x6 photo paper. It shows fine onscreen but isn't printing out the way I see it on the screen.