Results 1 to 2 of 2
  1. #1
    Kris3579 is offline Member
    Join Date
    Dec 2013
    Posts
    6
    Rep Power
    0

    Question Code is running backwards!!!

    Java Code:
        protected void SetData() {
            for (int _i = 127; _i > -1; _i--) {
                dat[_i] = tData[tIndex+_i];
            }
            
            for (int _i = 0; _i < 128; _i++) {
                SetBlock(dat, _i);
            }
        }
    
        protected void SetBlock(byte[] _blocks, int _index) {
            switch (_blocks[_index]) {
                case (byte) 0x00: 
                    for (int _y = 0; _y < 64; _y++) {
                        for (int _x = 0; _x < 64; _x++) {
                            segBitmap.setPixel(_x, (tHeight*_index)+_y, Color.parseColor("#00E0FF"));
                        }
                    }
                break;
                
                default:
                    if (_index > -1) {
                AlertDialog.Builder alert = new AlertDialog.Builder(mainActivity);
                alert.setCancelable(true);
                alert.setPositiveButton("OK", null);
                alert.setMessage(Integer.toString(_index));
                alert.create().show();
            }
                break;
            }
        }
    Hello, the _index variable = 127 but supposed to = 0 in statement.I would like to know the problem. Please help.

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    4,025
    Rep Power
    6

    Default Re: Code is running backwards!!!

    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. [SOLVED] Backwards compiling and Generics
    By kammce in forum Advanced Java
    Replies: 5
    Last Post: 07-19-2012, 09:16 AM
  2. Running code on GPUs
    By atomant in forum New To Java
    Replies: 1
    Last Post: 05-15-2012, 02:07 AM
  3. I need help writing an array backwards
    By Brywiser in forum New To Java
    Replies: 1
    Last Post: 12-08-2011, 01:55 AM
  4. Replies: 1
    Last Post: 02-12-2011, 06:36 PM
  5. my code compiling but not running
    By girishkumar in forum New To Java
    Replies: 16
    Last Post: 03-16-2010, 05:45 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •