Arrays.toString problem

Hello,
I'm trying to print out the values of an integer array using the method toString(int a[]) of the Arrays's class. While doing it, I encounter the following error:
Array.java:17: toString() in java.lang.Object cannot be applied to (int[])
          System.out.println (Arrays.toString(a));
The source code is the following:
import java.util.*;
class Array{
     public static void main (String[] args){
          int[] a = new int[10];
          Random rand = new Random ();
          for (int i=0; i<a.length; i++)
               a= rand.nextInt(10);
          Arrays.sort(a);
          System.out.println (Arrays.toString(a));
Hope someone can help me!
Thanks a lot.
Gabriel

sabre150 wrote:
Sounds like an interesting little project. I've been trying to write an article on cross platform/language encryption so I've been doing little bits of C/C++/C#/Python/PHP/JNI . I don't find writing easy so the task is turning out to be a lot bigger than I anticipated.
I have fond memories of electric shock treatment. Having trained as an Electrical Engineer I spend the first 4 years of my working life trying to kill myself. Nearly succeeded twice. Now I long to get back to the sort of breadboards that you are working on but no real chance. I would like to create a playing card dealing system but my hardware knowledge is so out of date that I don't really have a hope.Stay far away from hardware; I once fell for it and designed a little logic game in hardware (Nim); I got it all together, including the total costs (just a few bucks) and happily went to the electrickery store. They laughed at me and told me about power supplies and debouncing switches and buffers for the LEDs and what have you. After an hour I stood outside again after having spent almost 200 bucks. I started soldering and I soldered and soldered; in the end I had a big blob of spaghetti and it didn't work. I started all over again and I ended up with an even bigger blob of spaghetti that didn't even fit anymore in the little box I bought. But it worked.
I had fun for almost 10 minutes until my little rabbit (I kept it as a cat) saw it, chewed on the spaghetti blob and it never worked again ... so far for hardware; don't go there.
kind regards,
Jos ;-)

Similar Messages

  • Error using Arrays.toString()

    Hi there,
    I am getting the following error using Arrays.toString on a String Array. 'toString() in java.lang.Object cannot be applied to (java.lang.String[]).
    The line in question is at the bottom of the below code. It starts 'rtitem.appendText.....
    import lotus.domino.*;
    //import java.util.Arrays;
    public class JavaAgent extends AgentBase {
         Database curDb;
         String[] dbList;
         public void NotesMain() {
         int dbcount = 0;
              try {
                   Session session = getSession();
                   AgentContext agentContext = session.getAgentContext();
                   //get current database
                   Database curDb = agentContext.getCurrentDatabase();
                   //build a list of servers;
                   String[] servers = {"Norwich002/Norwich/MoneyCentre","Norwich003/MoneyCentre","Norwich004/MoneyCentre","Norwich005/MoneyCentre","Norwich007/Norwich/MoneyCentre","Norwich008/Norwich/MoneyCentre","Norwich010/Norwich/MoneyCentre","Norwich020/Norwich/MoneyCentre","Norwich021/Norwich/MoneyCentre"};
                   //loop through server list
                   int arraylen = servers.length;
                   for(int i=0;i <= arraylen;i++){
                        //create a notesdbdirectory collection for the current server iteration
                        DbDirectory dbdir = session.getDbDirectory(servers);
                        //get first database
                        Database db = dbdir.getFirstDatabase(DbDirectory.DATABASE);
                        //loop through databases in dbdir
                        while (db != null){
                             //add database details to our list
                             dbList[dbcount] = db.getTitle() + " - " + db.getFilePath();
                             dbcount++;     
              } catch(Exception e) {
                   e.printStackTrace();
              private boolean sendEmail(String subject){
                   try{
                        Document mailDoc = curDb.createDocument();
                        mailDoc.replaceItemValue("SendTo","Hayleigh S Mann/Norwich/MoneyCentre");
                        mailDoc.replaceItemValue("Subject",subject);
                        RichTextItem rtitem = mailDoc.createRichTextItem("Body");
                        rtitem.appendText(java.util.Arrays.toString(dbList));
                        mailDoc.send();
                        return true;
                   }catch(Exception e){
                        e.printStackTrace();
                        return false;

    No, that doesn't make any sense. Arrays.toString can take any array as an arg: [http://java.sun.com/javase/6/docs/api/java/util/Arrays.html#toString(java.lang.Object[])]
    import java.util.*;
    public class A {
      public static void main(String[] args) {
        String str = Arrays.toString(args);
        System.out.println(str);
    :; java -cp . A abc 123 xxx
    [abc, 123, xxx]

  • Associative Array (Object) problems

    Here is the function i'm dealing with
    i'm reading in a delimited string and using indexed arrays to
    break them up and assign the keys and values to an associative
    array in a loop.
    i'm using variables in the loop and the array loads as
    expected in the loop
    but outside the loop, the only key is the variable name and
    the value is undefined
    this is true using dot or array notation, as well as literal
    strings for the keys
    any help is appreciated
    watchSuspendData = function (id, oldval, newval):String {
    //the incoming suspendData string is delimited by the
    semicolon;
    //newval is: firstValue=Yes;captivateKey=1
    var listSuspendData:Array = newval.split(";"); // convert it
    to a list of key/value pairs
    if (listSuspendData.length > 0){
    //line 123: listSuspendData.length is: 2
    for (i=0; i < listSuspendData.length; i++){ //for each
    key/value pair
    var keyValArray:Array = new Array();
    var myNameValue:String = listSuspendData
    //line 127: listSuspendData is: firstValue=Yes
    keyValArray = myNameValue.split("="); // split 'em on the
    equal sign
    var myKey:String = keyValArray[0];
    var myVal:String = keyValArray[1];
    //keyValArray[0] is: firstValue
    //keyValArray[1] is: Yes
    // store the key and the value in associative array
    suspendDataArray.myKey = myVal;
    trace("line 134: suspendDataArray is: " +
    suspendDataArray.myKey);
    // trace is line 134: suspendDataArray is: Yes on the first
    pass and 1 on the second
    //the below loop always returns one array key: myKey and the
    value as undefined
    for(x in suspendDataArray){
    trace("x is: " + x); //x is: myKey
    trace("the val is: " + suspendDataArray.x); //the val is:
    undefined
    } //end for
    return newval;

    on lines 12-13 i assign the key=value pair to string
    variables
    then on lines 17-18 i assign those values to the associative
    array using dot notation
    the trace seems to work there
    the problem is that when the procedure exits the for loop,
    the associative array only has one key (myKey) and no value
    (undefined)
    all the documentation i've read shows using these types of
    arrays with either non-quoted property names like:
    myAssocArray.myKey = "somevalue";
    or
    myAssocArray[myKey] = "somevalue";
    i tried assigning the key/value pairs directly from the
    indexed arrays, but the result was always undefined
    like this:
    suspendDataArray.keyValArray[0] = keyValArray[1]
    or
    suspendDataArray[keyValArray[0]] = keyValArray[1]
    i even tried building a string in the loop and trying to
    assign all the pairs at once using the curly brace
    this is pretty wierd behavior for actionscript or i'm missing
    something basic here
    thanks for looking

  • Spreadsheet to array memory problems

    I'm trying to read a large .csv file (329 MB) and display a user selected column of data on a graph.  I have a standalone executable that does this wonderfully, however, I cannot contact the developer of this application to ask questions.  I just have the standalone executable, no code.  So I'm trying to write my own application with a slight modification.  The problem is I run out of memory for LabVIEW. 
    In the standalone execution the memory usage is as follows:
    515 MB - baseline memory usage
    523 MB - application starts
    1.25 GB - open 329 MB .csv file
    1.5 GB - open additional 63.6 MB .csv file
    Data from the first column is displayed on a graph.  Memory usage does not seem to change at all when I'm selection columns from either file for plotting on the graph.  CPU usage is also minimal when selecting columns; at most an occasional spike of 20%.
    In my application the memory usage is as follows:
    515 MB - baseline memory usage
    587 MB - LabVIEW starts
    598 MB - application starts
    657 MB - open 63.6 MB .csv file
    1.10 GB - convert spreadsheet string to 2D array
    2.04 GB - replace 1st row
    and then LabVIEW runs out of memory.  I've enclose the subVI that actually reads the .csv file and converts it to a 2D array.  Why is LabVIEW running out of memory for my application and not the standalone application?  Theories?
    Attachments:
    ExtractPortion.vi ‏33 KB

    Hey all,
    The in place element structure should be relatively straightforward, once you understand the concept behind it, which is that it keeps everything in the same memory location and does think about resizing it. Thus, deleting items in an in place structure would not function. Replacing items should however, as discussed in this help document: http://zone.ni.com/reference/en-XX/help/371361G-01/glang/in_place_element_structure/ and as shown here:
    I tried to reproduce your issue, but I managed to make both notepad and word crash in the production of a large enough CSV file. My recommendation is go ahead and split the file up if at all possible. Since you said the code fails on the delete node, you could also simply use the array subset function to pull out all but the line you want to delete, rather than asking labview to give you a second memory location. On the other hand, on my computer the problem occurs at the VI which converts to a spreadsheet string--however, if I set .csv to false (meaning that VI does not have to convert to a float) it does not have a problem. My suggestion would be to convert it to a string first, then use the in place element structure to convert items one by one to the %f format, rather than %s. This is especially true since you are converting string to %f and then back to string (because you selected a 2-d string array as your output).
    Thanks,

  • Array declaration problems

    hi
    i am having problems with my array declarations
    import java.io.*;
    public class bubbleSort4{
      public static void main (String []args) throws IOException{
        BufferedReader input=new BufferedReader (new FileReader("numbers.txt"));
        for (int blah=0; blah<0; blah+=1 ){
        int array1[];
        array1[blah]=Integer.parseInt(input.readLine());
        }//end of for
        input.close();
        bubbleSort4(array1);
      }//end of main
    public static void bubbleSort4(int[] array1) {
      int newLowest = 0;            // index of first comparison
        int newHighest = array1.length-1;  // index of last comparison
        while (newLowest < newHighest) {
            int highest = newHighest;
            int lowest  = newLowest;
            newLowest = array1.length;    // start higher than any legal index
            for (int i=lowest; i<highest; i++) {
                if (array1[i] > array1[i+1]) {
                   // exchange elements
                   int temp = array1; array1[i] = array1[i+1]; array1[i+1] = temp;
    if (i<newLowest) {
    newLowest = i-1;
    if (newLowest < 0) {
    newLowest = 0;
    }//end of if
    } else if (i>newHighest) {
    newHighest = i+1;
    }//end of else if
    }//end of if
    }//end of for
    }//end of while
    }//end method bubbleSort4
    }//end of class
    i get the error where i call the bubbleSort4 method with the array1 in brakets, it says that it doesnt recognize the variable. i know thats because i declared it in the for loop, but when i declare the array outside the for loop, it says that it was not initialized when i use it in the for loop. a vicious cycle. lol. so please, someone help....

    int array1[];you must initilize the array1
    example :
    int [] array1 = null;or
    int [] array1 = new int [10];
    for (int blah=0; blah<0; blah+=1 ){the codes will never go into the above for loop since
    blah always >= 0;

  • Array index problem in formula node

    dear friend
    I'm trying to use formula node to solve a problem because I make this program using c at the begining.
    It runs perfectly in turbo c, but somehow it doesn't work in the formula node.
    I try to debug my source code, and I find that the formula node seems can't read the true value in
    the array.
    Here is the code in the formula node.
    int32 i,j,k;
    for ( i = 0 ; i < sopa; i++ )
     j = 1;
     ep[i][0] = pa[i];
     ep[i][1] = np[ep[i][0]][0];
     while ( ep[i][j-1] != exit )
      for ( k = 0 ; k < sonp ; k++ )
        if ( np[ep[i][j-1]][k] != -1 && (pc[ep[i][j-1]][ep[i][j]] + pc[ep[i][j]][exit] >= pc[ep[i][j-1]][np[ep[i][j-1]][k]] + pc[np[ep[i][j-1]][k]][exit] ) && (pc[ep[i][j-1]][np[ep[i][j-1]][k]] == org[ep[i][j-1]][np[ep[i][j-1]][k]] ))
          ep[i][j] = np[ep[i][j-1]][k];
      j++;
    This is the part that I think the problem might be.
    if ( np[ep[i][j-1]][k] != -1 && (pc[ep[i][j-1]][ep[i][j]] + pc[ep[i][j]][exit] >= pc[ep[i][j-1]][np[ep[i][j-1]][k]] + pc[np[ep[i][j-1]][k]][exit] ) && (pc[ep[i][j-1]][np[ep[i][j-1]][k]] == org[ep[i][j-1]][np[ep[i][j-1]][k]] ))
     ep[i][j] = np[ep[i][j-1]][k];
    I state that "np[ep[i][j-1]][k] != -1" but I do get the value -1 in the array "ep".
    Could someone tell me why I get -1 in the array?
    I hope I can finally do it all by labview not using formula node,but array like "pc[ep[i][j-1]][np[ep[i][j-1]][k]] "
    seems very hard to wire in labview. Could someone give me some good advices of doing this?
    Thanks for your help

    altenbach 已寫:
    normanshi wrote:
     ep[i][0] = pa[i];                                          (A)
     ep[i][1] = np[ep[i][0]][0];                            (B)
    ...    if ( np[ep[i][j-1]][k] != -1 && ... )          (C)
          ep[i][j] = np[ep[i][j-1]][k];                       (D)
    I state that "np[ep[i][j-1]][k] != -1" but I do get the value -1 in the array "ep".
    Could someone tell me why I get -1 in the array?
    I hope I can finally do it all by labview not using formula node,but array like "pc[ep[i][j-1]][np[ep[i][j-1]][k]] "
    seems very hard to wire in labview. Could someone give me some good advices of doing this?
    There are many possible scenarios to get a -1 in the ep output. For example if the -1 gets already written in step (A) or (B) at a certain index, and that index does not get overwritten in step (D). You are indexing all over the place! Is there some bounds checking on the array contents? What are typical inputs and array sizes?
    I'm sure about that the -1 doesn't get already written in step (A) or (B) because ep[i][0] and ep[i][1] is fine. What really makes me confuse is that sometimes ep array has the value like this.
    That means it does overwritten some value in step (D). The -1 should never be written into it because I have already state that np[ep[i][j-1]][k] != -1. Somehow I still get -1,and this is really strange! I'm indexing all over the place becuase I can't figure out a better way to achieve my requirement.
    I think I should briefly tell you what I'm trying to do. In this program,I input some values which means the distance from one point to another. Then I use floyd's all pairs shortest-path algorithm to find all the shortest distance. Finally I want to find out the "shortest path". I mean like from point 4 to point 0,the shortest path might be like 4 -> 2 -> 1 -> 0, and what the formula node part do is trying to find out this "shortest path". Maybe you can give me some better advice of doing this, I have been thinking a better way to do it for about two months. I think I'm really not good at this.
    I try to do it all by labview ,but again I get a strange problem. This time the ep[i][j-1] doesn't get the correct value. In the first time i=0 j-1=0 ep[i][j-1] = 1,but the second time i = 0 j-1 = 1 ep[i][j-1] = 0. This makes the "ep[i][j-1]!=exit" get the incorrect boolean value. The ep[i][j-1] should be 2,not 0. I try to use highlight to find if I make any mistake, but I can't one.This is the input and I put the labview program in attached file (temp4.vi).
    Could you help me find out why this happened?
    Thanks for your help altenbach!
    由 normanshi 在 08-19-2006 10:06 PM 上編輯的訊息
    Attachments:
    temp4.vi ‏191 KB
    ep.jpg ‏10 KB
    input.jpg ‏9 KB

  • Control Array Access Problem while loading panel on 2 Tabs

    I am using LabWindows CVI 10.0. My intention is to programmatically disable a control array in a panel.
    Problem:
           I am loading a panel with control array in TabControl pages -  Tab0 and Tab1.
    Error occurs, While programmatically accessing through below functions.
    GetCtrlArrayFromResourceID( Tab0_panel, CTRLARRAY) -  Able to get resource ID.
    GetCtrlArrayFromResourceID( Tab1_panel, CTRLARRAY) - Not able to get resource ID.
    Its giving error as Resource ID not found in UIR.
    Error picture i have attached below for reference.
    Please give some suggestions.
    Solved!
    Go to Solution.
    Attachments:
    Error.PNG ‏7 KB

    Ok, if you didn't use it so far you should use it now  : If you are accessing controls on a tab panel you have to use the correct panel handle using the function GetPanelHandleFromTabPage, you can not simply use the constant defined in your UIR.
    Have a look at the example TabExample.cws for an example of this function.

  • ToString problem...

    Hi,
    I couldn't find out what is the problem in this code...
         public String toString()
              return (getName() + " containing " + getNumFish() + " fish.");
         }I always get an "')' is expected" error...

    I always get an "')' is expected" error...When you have mismatched parenthesis the error may not be where it's reported. I guess you have more methods so carefully check that the ( mathches the ) in the class all the way through.

  • JRockit 1.4.2 array clone problem

    JRockit 1.4.2 throws an IllegalAccessError on array cloning code produced by javac
    -target 1.4.2. This seems to be the same problem as Sun's bug #4750641 (fixed
    as of 1.4.1_01). JRockit 8.1 works okay. The problem also occurs with code produced
    by a current version of IBM's jikes compiler.
    To reproduce:
    public class a {
    public static void main(String[] args) {
    new int[10].clone();
    When compiled with "javac a.java", it works okay. When compiled with "javac -target
    1.4.2 a.java", JRockit throws an IllegalAccessError.

    I can confirm this problem. We are working on a fix for the next service
    pack. Thanks for the bug-report!
    Regards,
    /Staffan
    Nathan Bronson wrote:
    JRockit 1.4.2 throws an IllegalAccessError on array cloning code produced by javac
    -target 1.4.2. This seems to be the same problem as Sun's bug #4750641 (fixed
    as of 1.4.1_01). JRockit 8.1 works okay. The problem also occurs with code produced
    by a current version of IBM's jikes compiler.
    To reproduce:
    public class a {
    public static void main(String[] args) {
    new int[10].clone();
    When compiled with "javac a.java", it works okay. When compiled with "javac -target
    1.4.2 a.java", JRockit throws an IllegalAccessError.

  • Array Copy Problem

    ARRAY COPY DOESN'T WORK. DO NOT ATTEMPT TO USE IT IN YOUR REPLY TO THIS TOPIC. array copy says that you need the same type of object in the arrays. I'm making a method in a class called SUPERARRAYUTIL where this isn't the case. They all extend from a class i made called SUPERARRAY (in javacase caps tho, i just like to use upper case), but that doesnt help me. I'm short on time and i want to post this right now, so i won have any code right away but here is how i'm gonna do it:
    1) Static method takes parameters superArray array, superArray newelements, and int start
    2) Make a temp array that would be big enough to fit array, and the newelements at postion start in array
    3) copy over array using a for loop, starting at 0 in temp.
    4) copy over newelements using a for loop, starting at start in temp.
    Then i will make non-static methods for superArrayUtil that will use the static methods in superArrayUtil. I will also make a method like System.arraycopy but will call a method called cut to trim the array of new elements and then call this arraycopy to copy it into the dest array, and then another non-static method for that method too.
    Basically i just need ideas or comments cause so far i ran into some weird problems or any suggestions if there's a better way to copy arrays in the general way of array1 into array2 at a starting position.

    Deo_Favente wrote:
    ARRAY COPY DOESN'T WORK.
    YES. YES IT DOES. WHY DO YOU THINK THAT IT DOESNT WORK? WHY DON'T YOU POST WHATEVER CODE THAT YOU DO HAVE THAT IS CAUSING YOU PROBLEMS AND THEN MAYBE WE COULD WORK WITH IT. I THINK THAT'S A BETTER IDEA PERSONALLY, AT LEAST OPPOSED TO WHAT YOU DID HERE._+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Beginner : Array , String Problems continue.

    Hi everybody I am so New in Java or rather not really able to understand Java yet.
    I have assignment where I do not know how to think anymore..is probably very easy to those who understand programming but sadly I do not.
    Program should do:
    1. assign any amount of different strings.
    2. user is giving any letter he/she wants and program to find it among given strings.
    If searched letter is in any string/ strings , only these strings or string are printed.
    3. If in given strings is not searched letter, program has to say it, for ex: there is not letter you search for.
    As long as now I have only, strings assigning to array. So there are strings in array but I do not know how to write code where I can find given letter by user.
    I just do not know how I should think(anymore at all ;)) here. I am really frustrated and desperate, how to understand this?? Once and for all!!!
    I was thinking maybe I should use ArrayList? but how...or Can it be done both ways with Array or with ArrayList?
         public static void main(String[] args) {
              Scanner scan = new Scanner(System.in);
              System.out.print("How many strings ?");
              int antal= scan.nextInt();
              String [] str = new String[antal];
               String string = null;     
              int x;
               scan.nextLine();
                 for( x=0;x<str.length;x++){
                      System.out.print("String "+(x+1)+": ");                       
                 string= scan.nextLine();
                 str[x]= string;
                System.out.print("Write a letter you wish to find :");
                String letter = scan.nextLine();
                char check = letter.charAt(0);
      //somthing in here ....

    Thank you very, very much for helping me, this is the first forum where I am getting any answers at all. Thanks guys!
    Yes, that is true I have a problem to "see" things in code..I feel " lost in translation " :)...Sometimes I think I understand code and than suddenly code does total different thing than I thought. I have to pass 2 exams of Java basic and bit advance level of Java , all seems very dark now..but I have a hope that I at least pass those exams. Of course it could be fantastic to start understand Java (or any other computer language) and be able to code one day for real. To be honest, I envy you that you can understand Java. When, all code works is so cool and fun! ok, Back to code...
    So I read your tips and advices , thanks.
    Here is another problem, with help of indexOf(char) I got index for character I searched, fine.
    The way i wrote the code I got separate answer for each string(check in code). What I need to have is, separate printed strings where given character is found and nothing else should be printed. Later, I need just one general comment ,only in case if character is NOT found in given strings.
    import java.util.*;
    public class upp9 {
         public static void main(String[] args) {
              Scanner scan = new Scanner(System.in);
              System.out.print("How many strings ?");
              int antal= scan.nextInt();
              String [] str = new String[antal];
              int x;
               scan.nextLine();
                 for( x=0;x<str.length;x++){
                      System.out.print("String "+(x+1)+": ");                       
                 str[x]= scan.nextLine();
                System.out.print("Write a letter you wish to find :");
                String letter = scan.nextLine();
                char check = letter.charAt(0);
                   for( x=0;x<str.length;x++){
                       str[x].indexOf(check);
                     //     System.out.println("String "+(x+1)+" "+str[x].indexOf(check));
                if((str[x].indexOf(check))>=0)
                     System.out.println("String "+(x+1)+" "+str[x]);
                else
                     System.out.println("Nothing in this string");
      System.out.println();
    }is printed.
    How many strings ?4
    String 1: hello
    String 2: other
    String 3: alex
    String 4: batman
    Write a letter you wish to find :a
    Nothing in this string
    Nothing in this string
    String 3 alex
    String 4 batmanI should get printed (with other code)...where I don't know how to think here? what code I should use?, what I can what I can not do here...hmmm
    //in case found
    How many strings ?4
    String 1: hello
    String 2: other
    String 3: alex
    String 4: batman
    Write a letter you wish to find :a
    String 3 alex
    String 4 batmanor....
    //in case NOT found
    How many strings ?4
    String 1: hello
    String 2: other
    String 3: alex
    String 4: batman
    Write a letter you wish to find : j
    Not found

  • Array position problem

    HI everyone I am looking for some help on an array problem.
    I am reading in a text file that is in a line by line format eg.
    apple
    orange
    pear
    etc
    The problem is that I want my array to increment each line. However each time a new line is read from the text file the array postion goes back to zero. Im assuming theres something wrong with my loop. Somebody please help!!!
    String line;
    String[] words;
    int i;
    try { 
    BufferedReader reader = new BufferedReader(new FileReader("wordlist.txt"));
    while((line = reader.readLine()) != null){
    words = line.split(" ");
    for(i = 0; i < words.length; i++){
    Arrays.sort(words);
    //System.out.println(words);
    if(findWord.equals(words[i])) {
    Cap = "the word was found at position " + Arrays.binarySearch(words, words[i]);
    test=true;
    checkString();
    reader.close();
    I I read in
    apple orange pear
    carrot cucumber tomato
    then apple[0] orange[1] pear[2]
    but then this resets to 0 on new line i.e
    carrot[0] cucumber[1] tomato[2]

    Correct me if Im wrong but I think I have created the
    array out side the loop.Your original code declares the array outsid of the loop, but it doesn't create it. It just allocates a reference variable that will point to the aray.
    Inside the loop, where you do words = split you're creating a new array each time. (And like I said, if there's only one word on a line, you don't need to spilt.)
    As for putting the next
    lines word into the array on each loop pass I do not
    understand how to do this. Any help would be
    appreciated?
    for (int ix = 0; ix < numLines; ix++) {
        arrar[ix] = the line that you just read
    } Of course, if you're using the standard while (line != null) for loop control, then you can just skip the for part and create an index variable that you increment inside the body of the loop.

  • Array rebuild problems

    Hi
    Here's the situation, when replacing our broken raid drive it rebuilt the array, having rebuilt, it somehow messed up all the resource forks for the os9 files stored on it. We do have all the data backed up on tape but the backup system is windows based and failed to backup the resource forks as they weren't unix files.
    Our main problem is quark files, I can open them on my mac using quark 6 as it's osx based, but I'm the only one in the company who has quark 6, is there any way of re-cxreating the resource forks so that they can be read by quark 4? Is there a nifty 3rd party piece of software that will scan a volume and rebuild all the resource forks for the os9 files - or am I just clutching at an impossible dream!!!!

    Think I've fixed it.
    By adding a physical extention (.qxd) to the end of the quark file then opening it from within quark and not via double-clicking, it opens, once you save it from here the file is fine and the same as it was before.
    For some reason, even with the .qxd extention it won't open in quark by double-clicking, only through the file menu. Also it won't work if you try this on an osx machine, only if you're booted in os9.
    weird but it works.

  • Array Splice problems...

    Hi i am loading in xml into Flash
    <question ID="n3.1a" level="3" />
    <question ID="n3.2b" level="3" /> ... etc all the way
    to n3.12b
    So what i am trying to do is to Splice the array into 2 parts
    all the questions ID's that are A and all that are B for for
    example an array with:
    level3a_Array = [n3.1a,n3.2a,n3.3a,n3.4a]
    level3b_Array = [n3.1b,n3.2b,n3.3b,n3.4b]
    but i am having problems with the code below trying to splice
    them, so any help would be great!!!
    var diagnosticXml:XML = new XML();
    diagnosticXml.ignoreWhite = true;
    diagnosticXml.load("databank/databank.xml");
    diagnosticXml.onLoad = function(success:Boolean){
    if(success){
    aLevel = diagnosticXml.firstChild.childNodes;
    lev3Array = aLevel[0].childNodes;
    for(var a=12; a>0; a--){
    var level_3:Number = _root.aLevel[0].childNodes.length;
    _root.aLevel[0].childNodes.splice(0, 1);
    lev3B_Array = _root.aLevel[0].childNodes.splice(0, 1);
    trace("lev3Array: "+ lev3Array);
    }

    intialize both arrays and then push every other node into
    your arrays.

  • Array copying problems

    I'm sure this is a stupid question, but I'm not immensly knowledgeable about all the ins and outs of Java yet.
    I have 2 arrays of 81 elements, one known as groups and one as tempGrps. I used the System.arraycopy(groups,0,tempGrps,0,81) to copy groups to tempGrps. The problem I am encountering is that when groups is modified after the arraycopy, the same modifications are made to tempGrps. I have a small routine in place that checks the contents of tempGrps. When the arraycopy command is in place, tempGrps has the modifications that are made to groups also made to it. When the command is not there, tempGrps remains empty(this was tested to make sure I wasn't somehow modifying it somewhere else). What is going on here? The entire reason for the tempGrps array was to hold a temporary backup of the groups array.

    Could you explain this please? I mean, when I say
    MyObject = new
    MyObject(objectToCopy);How do I end up with
    the wrong type of Object?Easily: When objectToCopy is a MyCustomObject that is
    derived from MyObject.I think I see what you're saying - though, by explicitly saying that (woops, forgot the reference name there) myObject is of type MyObject, it's obvious you wanted a MyObject out of that ctor call, and since MyCustomObject is a MyObject then I think it's a stretch to say you get the wrong object type back.
    >
    Disclaimer: I haven't really read the article yet and
    don't feel strongly for either side of the argument,
    that's just one problem I've spotted.

Maybe you are looking for

  • Store complaint

    So, I switched to Verizon from Sprint, to combine with my girlfriend's plan.  I haven't had an issue with MY phone, so I hadn't experienced much customer service with Verizon until now.  My girlfriend's LG EnV Touch was turning off on it's own.  She

  • I just downloaded iOS 6 to my iPhone 4 and all-of-sudden, the camera on the back of my phone isn't working.  Anyone know how to fix this?

    I just downloaded iOS 6 to my iPhone 4 and all-of-sudden, the camera on the back of my phone isn't working.  Anyone know how to fix this?

  • JSP from Java Script???

    Can I call any jsp method from javascript?? I have a jsp page that contains some java script code..and I want to call one method of it from javascript. Thanks

  • OpenVZ and Arch

    i am in progress of migrating my servers from gentoo to arch.  i am trying to build an openvz host os in arch, simply because its easier to maintain than gentoo and less needlessly complex IMO.  this package: http://aur.archlinux.org/packages.php?ID=

  • Is anyone having issues with 27" imac screen calibrating?

    I may have to post this on the imac forum, but figured i'd ask the photographers here using aperture. I've heard that calibrating the monitor on a new 27" imac is not very easy, or can't be done because of the lack of adjustments on the screen itself