Int to word

Hi all. I need to convert an int (say, ]-1234[/code) to a word (0xFB2E) but for the life of me I don't seem to be able to do this. I've had a look at posts with similar topics, I've tried many suggestions, but I am not having any joy. I would really appreciate it if someone could help me out.

aaahh...the breath and width of this wonderful language never seizes to astound me. OK, so I'm a bit of an old newbie, but still.
It was after uj pointed out to me that I was being daft by not just writing shorts to a file that my focus shifted from the method I was trying to use to convert a decimal number to hex, to the way i was writing to the file.
Thanks uj.
I was using BufferedWriter. Now I am using RandomAccessFile...like so:
//some preceding code...
RandomAccessFile raf = new RandomAccessFile(fileName, "rw");
raf.seek((long)header[x]);//this is the end of the header block
///inside for loop...
raf.writeShort(audioData)
//end of loop
raf.close();
///and so on...

Similar Messages

  • Word Frequency Counter...

    Hello all, I am working on a project that is supposed to read in a text file from a command prompt, and then break all the words up. As the words are read in by the Scanner, I need to have a counter that counts the number of times the word has occured already that I can access and display in the output. I have come up with this so far as my driver/main class, and also the Count class that I'm trying to use to keep track of the number of times a word has occured in the text, and then so I can add it to a HashMap and display later... The problem is, whenever I try to run the program with a text file, it just ends up displaying all the words in a line and then a number 1 next to it. What I need is the output to look similar to this... For example,
    hello 1
    world 1
    Any help would be appreciated! Thanks.
       import java.io.*;
       import java.util.*;
        public class Driver{
           public static void main(String[] args){
             HashMap words = new HashMap();
             String nameOfFile = args[0];      
             File file = new File(nameOfFile);
             String wordd;
             Count count;
             try{
                Scanner scanner = new Scanner(file).useDelimiter(" \t\n\r\f.,<>\"\'=/");
                while(scanner.hasNext())
                   String word = scanner.next();
                   count = (Count) words.get(word);
                   if(count==null){
                      words.put(word, new Count(word, 1));
                   else {
                      count.i++;
                   System.out.println(word);
                 catch(FileNotFoundException e){
             Set set = words.entrySet();
             Iterator iter = set.iterator();
             while(iter.hasNext()) {
                Map.Entry entry = (Map.Entry) iter.next();
                wordd = (String) entry.getKey();
                count = (Count) entry.getValue();
                System.out.println(wordd +
                   (wordd.length() < 8 ? "\t\t" : "\t") +
                   count.i);
    {code}
    {code}
    public class Count
         String word;
         int i;
         public Count(String inputWord, int increment)
              word = inputWord;
              i = increment;
    {code}
    Edited by: VisualAssassin on Apr 22, 2009 2:45 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    VisualAssassin wrote:
    Scanner scanner = new Scanner(file).useDelimiter(" \t\n\r\f.,<>\"\'=/");
    {code}According to the documentation for Scanner.useDelimiter(), the String supplied is used as a regular expression. Therefore, for the scanner to tokenize into two separate tokens, your input stream would have to contain all of those listed characters in order!
    Instead, use this (untested):
    {code}
    Scanner scanner = new Scanner(file).useDelimiter("[" + Pattern.quote(" \t\n\r\f.,<>\"\'=/") + "]+");
    The beginning and end square braces tell the regular expression engine to match +any+ of those characters, and the plus means one or more times.  The Pattern.quote is used to escape some of the characters that would get you into trouble because they have a special meaning in regexes, notably "."
    Edited by: endasil on 22-Apr-2009 11:43 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to count words in a text ?

    Hi all,
    can anyone show me how to count the number of words in a text.
    thank in advandce,
    Toan.

    Hi,
    Are you reading the text from a file or is it stored in a string buffer?
    The best way would be to use a StringTokenizer assuming that all your words are separated by a space ' ' you could use that as your delimiter.
    Something like..
    String text = "This is just a bunch of text stored as a string.";
    StringTokenizer words = new StringTokenizer( text, " ", false );
    int numberOfWords = words.countTokens();I hope that helps,
    .kim

  • Operator + cannot be applied to operands of type 'method group and 'int'

    Hello I have a problem that I'm trying to fire a bullet everytime I pressed the spacebar key, but I have this problem that is cropping up.
     if ((e.KeyCode == Keys.Space) && (playerOne.Bullet.Alive == false))
                                playerOne.Bullet.Alive = true;
                                playerOne.Bullet.getX = playerOne.getXposition + 15;
                                playerOne.Bullet.getY = playerOne.getYposition + 10;
    It says in the error list: "Opeartor '+' cannot be applied to operands of type 'method group' and 'int'", I have no clue. I'm also new to programming.

    I want to get the bullet to shoot where the player is, here is the code:
    class Player
            // attributes here  -   Int other words data types and variables:
            int health = 3;
            float xPosition;
            float yPosition;
            Bitmap playerGraphics;
            int score = 0;
            bool leftPressed;
            bool rightPressed;
            float Width = 50;
            public Bullet Bullet = new Bullet();
            // functions here:
            public void Init()
                // Get Player_Bat.png from resources, so that we can work with it:
                playerGraphics = new Bitmap(Green_Aliens.Properties.Resources.Player_Bat);
                health = 3;
                score = 0;
                xPosition = 375;
                yPosition = 540;
                leftPressed = false;
                rightPressed = false;
                Bullet Bullet = new Bullet();
            public float getWidth()
                return Width;
            public void toggleLeftPressed()
                if (leftPressed == true)
                    leftPressed = false;
                else
                    leftPressed = true;
            public void toggleRightPressed()
                if (rightPressed == true)
                    rightPressed = false;
                else
                    rightPressed = true;
            public bool getLeftPressed()
                return leftPressed;
            public bool getRightpressed()
                return rightPressed;
            public Bitmap getGraphics()
                return playerGraphics;
            public float getXposition()
                return xPosition;
            public float getYposition()
                return yPosition;
            public int getHealth()
                return health;
            public int getScore()
                return score;
            public void moveLeft()
                xPosition -= 10;
            public void moveRight()
                xPosition += 10;
            public void loseLife()
                health--;
            public void adScore(int valueAdd)
                score += valueAdd;
            //Resets the player to the start position:
            public void resetPosition()
                xPosition = 400;
                yPosition = 550;

  • Missing help with similar word

    It is problem with search words in help.
    It is FF version independed.
    I use this category, because no one from listed fits.
    for example. I looking for help with word "cookie". Help should search for 'cookie' and "cookies'.
    another example with polish language.
    I tryed to find help about word 'ciastko'. no one were found, i should write word 'ciasteczko', that list me usefull help topics.
    'ciastko', 'ciasteczko', 'ciastka', 'ciasteczka' are about the same thing 'cookie', but are variants by plural/singular and diminutive. Difference is the same like between 'cookie' and 'cake', but all means the same 'cookie' in polish language.
    this problem affects many words in many languages.

    I have a basic Vowel coding that doeswnt work...
    public class vowel{
    String word = "heyyou";
    String vowels = "aeiouy";
    int[] countv = new int[vowels.length()];
    int countv2;
    int i=0;
    if(i<word.length();) { i++ {
    if (int j=0 && j<vowels.length()) {
    return j++;
    if (word.charAt(i)==vowels.charAt(j)) {
    countV[j]++; countV2++;
    for (int i=0; i<vowels.length(); i++) {
    System.out.println("Vowel "vowels.charAt(i)" = "+vcnt);
    System.out.println("Consonants = "+(word.length()-vtot)); }
    I also have a basic Palindrome code that works as a boolean but I need to make it return what the palindromes are and how many of them are there. I wanna know how I would do this.
    public class Palindrome{
    public static boolean isPalindrome(String word) {
    int left = 0;
    int right = word.length() -1;
    while (left < right) {       
    if (word.charAt(left) != word.charAt(right)) {
    return false;
    left++;
    right--;
    return true;
    I would also like to know how to actually start writing the word counter.

  • Help with a Word Counting Program..

    I need some help with a program I am trying to write
    The program is being written in BlueJ.
    Im just starting the program and am completely confused on how I should write this...
    But here is what I have to do..
    I have to use a scanner to scan a Text file and count the # of Words the number of Vowels (including Y when it is) and the # of Palindromes (Word spelled same forward and Back) as well as which Palindromes are being used.
    It would be good to have a class to clean the text and a seperate class for the tasks...
    I do not want to use anything other than "If" statements and while loops (no "for" loops) and only use Printwriter as the output file writer.
    Thnx to anyone in advance

    I have a basic Vowel coding that doeswnt work...
    public class vowel{
    String word = "heyyou";
    String vowels = "aeiouy";
    int[] countv = new int[vowels.length()];
    int countv2;
    int i=0;
    if(i<word.length();) { i++ {
    if (int j=0 && j<vowels.length()) {
    return j++;
    if (word.charAt(i)==vowels.charAt(j)) {
    countV[j]++; countV2++;
    for (int i=0; i<vowels.length(); i++) {
    System.out.println("Vowel "vowels.charAt(i)" = "+vcnt);
    System.out.println("Consonants = "+(word.length()-vtot)); }
    I also have a basic Palindrome code that works as a boolean but I need to make it return what the palindromes are and how many of them are there. I wanna know how I would do this.
    public class Palindrome{
    public static boolean isPalindrome(String word) {
    int left = 0;
    int right = word.length() -1;
    while (left < right) {       
    if (word.charAt(left) != word.charAt(right)) {
    return false;
    left++;
    right--;
    return true;
    I would also like to know how to actually start writing the word counter.

  • Creating concordancer for two words

    I'm reading in a file, for example, text file:
    The big red cat jumped
    The big red bird flew
    I want to concordance this into word bigrams so that I get output:
    The big 2
    big red 2
    red cat 1
    cat jumped 1
    red bird 1
    bird flew 1
    Which counts the frequencies of each word bigram.
    I can do the counting part. But I don't know how to get the bigrams. I tried using a StringTokenizer, but that didn't count the duplicates. Where should I start with this?

    String[] words = line.split(" ");
    final int wordCount = words.length;
    final int bigramCount = wordCount - 1;
    String[] bigrams = new String[bigramCount];
    for (int i = 0; i < bigramCount; ++i) {
       bigrams[i] = words[i] + words[i + 1];
    }

  • Need help cutting down words...

    Hi,
    I'm creating a method where I have to cut a bunch of characters down to 10 characters.
    So Lets say I input ABCDEFGHIJKLM, it shoud return +"ABCDEFGHIJ"+. Also if I have characters shorter than 10 like ABC, it should just return +"ABC "+; with the spaces making up for the characters.
    I got the method working, but the problem is that if I enter ABCDEFGHIJKLM, it just cuts it to C and returns +"C "+.
    Can someone give me a hint where i'm going wrong with this?
    Here's my code:
    public static String trimTo10( String s ) {
              String words = "";
              for (int i = 0; i <= s.length() -1; i++) {
                   if(words.length()>=0 && words.length()<10) {
                        words = String.valueOf(s.charAt(i));
              if(words.length() < 10) {
                   for(int i =words.length() ; i < 10; i++) {
                        words = words.concat(String.valueOf(' '));
              return words;
         }

    DarrylBurke wrote:
    1. Concatenate a String of 10 blank spaces
    2. Extract the first 10 characters.I've done the concatenate part, but I don't understand 2. How do I extract the first 10 characters?
    Here's my code
    public static String trimTo10( String s ) {
              String n = "     "+"     ";
              for (int i = 0; i <= s.length() -1; i++) {
                   if(n.length()>=0 && n.length()<10) {
                        n = String.valueOf(s.charAt(i));
              if(n.length() < 10) {
                   for(int i = n.length() ; i < 10; i++) {
                        n = n.concat(String.valueOf(' '));
              return n;
         }

  • Extract x amount of words from a string

    hi all just wondered if some can help me with this
    String mySting = "This is a test String"
    getInput();   // this method returns a string and works
    getNoOfWordsInputted(); // returns int of words in the stringthis is where I need the help
    I now need to extract getNoOfWords inputted from myString
    ie such that if I input "this is " true will be returned
    I can implment the following
    if (getInput.equals(myString)){
    // do Something
    }

    Still not quite sure what you're after, but if you want to see if the target string starts with a candidate substring, just use the startsWith method.
    if (example.startsWith(sub)) ...
    or, you can still use the indexOf method, just check for a return value of 0, meaning the index of was at the beginning of the string.
    if (example.indexOf(sub) == 0) ...

  • Abap-- urgent

    hi all..
            can any one provide me with the links od the site tat provide me with the abap tips on performance tuning in abap,reports, ALV smart forms,IDOC, DDIC objects .. and entire abap..
    thnx

    Hi,
    Go through these link...
    this is the book on ABAP..
    It covers all the basic topics in ABAP..
    http://cma.zdnet.com/book/abap/index.htm
    check these links also...
    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htm
    for keywords
    very useful link for all
    http://www.sapgenie.com/abap/index.htm
    http://www.sap-img.com/abap.htm
    http://www.sapdevelopment.co.uk/tips/tipshome.htm
    http://help.sap.com/printdocu/core/Print46c/en/Data/Index_en.htm
    http://sap.ittoolbox.com/nav/t.asp?t=322&p=322&h1=322
    http://sap.ittoolbox.com/nav/t.asp?t=448&p=448&h1=448
    http://www.thespot4sap.com/
    http://www.kabai.com/abaps/q.htm
    http://www.geocities.com/mpioud/Abap_programs.html
    http://www.sapgenie.com/abap/tips_and_tricks.htm
    http://www.sapassist.com/code/d.asp?whichpage=1&pagesize=10&i=10&a=c&o=&t=&q=&qt=
    For FAQ
    http://www.sap-img.com/abap/more-than-100-abap-interview-faqs.htm
    http://www.sapgenie.com/faq/abap.htm
    BAPI-step by step
    http://www.sapgenie.com/abap/bapi/example.htm
    Weblog for receive email and processing it through ABAP
    /people/thomas.jung3/blog/2004/09/09/receiving-e-mail-and-processing-it-with-abap--version-610-and-higher
    For Logical database
    http://help.sap.com/saphelp_46c/helpdata/en/9f/db9bed35c111d1829f0000e829fbfe/frameset.htm
    very useful
    http://help.sap.com/saphelp_46c/helpdata/EN/35/2cd77bd7705394e10000009b387c12/frameset.htm
    Useful link to websites
    http://www.hernangn.com.ar/sap.htm
    Useful for background
    http://www.sappoint.com/basis/bckprsng.pdf
    http://help.sap.com/saphelp_nw04/helpdata/en/6f/08703713bf277ee10000009b38f8cf/frameset.htm
    http://publib.boulder.ibm.com/infocenter/wbihelp/index.jsp?topic=/com.ibm.wbix_adapters.doc/doc/mysap4/sap4x41.htm
    Table control in BDC
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    For posting weblog,
    /people/sap.user72/blog/2005/06/28/sdn-weblogs-making-it-easier
    Dynamic Internal table -weblog in sdn
    /people/subramanian.venkateswaran2/blog/2004/11/19/dynamic-internal-table
    Smartforms
    http://www.sap-basis-abap.com/sapsf001.htm
    http://www.sap-press.com/downloads/h955_preview.pdf
    http://www.ossincorp.com/Black_Box/Black_Box_2.htm
    http://www.sap-img.com/smartforms/sap-smart-forms.htm
    http://www.sap-img.com/smartforms/smartform-tutorial.htm
    http://www.sapgenie.com/abap/smartforms.htm
    How to trace smartform
    http://help.sap.com/saphelp_47x200/helpdata/en/49/c3d8a4a05b11d5b6ef006094192fe3/frameset.htm
    Workflow
    http://www.sap-img.com/workflow/sap-workflow.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/a5/172437130e0d09e10000009b38f839/frameset.htm
    For examples on WorkFlow...check the below link..
    http://help.sap.com/saphelp_47x200/helpdata/en/3d/6a9b3c874da309e10000000a114027/frameset.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PSWFL/PSWFL.pdf
    http://help.sap.com/saphelp_47x200/helpdata/en/4a/dac507002f11d295340000e82dec10/frameset.htm
    http://www.workflowing.com/id18.htm
    http://www.e-workflow.org/
    http://web.mit.edu/sapr3/dev/newdevstand.html
    ALV
    http://www.geocities.com/mpioud/Abap_programs.html
    Mail
    http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html
    http://www.thespot4sap.com/Articles/SAP_Mail_SO_Object_Send.asp
    http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
    Sending mail in background or spool mail
    http://www.sap-basis-abap.com/sapac018.htm
    BOM Explosion
    /people/prakash.singh4/blog/2005/05/15/explode-boms-in-enterprise-portal-using-htmlb-tree--part-1-abap
    BOM
    http://help.sap.com/saphelp_erp2005/helpdata/en/ea/e9b7234c7211d189520000e829fbbd/frameset.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/d1/2e4114a61711d2b423006094b9d648/frameset.htm
    http://www.sap-img.com/sap-sd/sales-bom-implementation.htm
    http://www.sap-basis-abap.com/sappp007.htm
    OLE
    http://www.sapgenie.com/abap/ole.htm
    http://help.sap.com/saphelp_46c/helpdata/en/59/ae3f2e488f11d189490000e829fbbd/frameset.htm
    ALVGRID with refresh
    http://www.geocities.com/mpioud/Z_DEMO_ALV_REFRESH_BUTTON.html
    For language setting and decimal separator
    /people/horst.keller/blog/2004/11/16/abap-geek-7-150-babylonian-confusion
    Oracle queries
    http://sqlzoo.net/
    To format SQL
    http://www.sqlinform.com/
    SCOT settings
    http://www.sap-img.com/basis/basis-faq.htm
    Status Icon [ALV,Table Control,Tab Strip]
    http://www.sapdesignguild.org/resources/MiniSG-old/from_develop/norm_status_icons.htm#positioning_4
    ALV Group Heading
    http://www.sap-img.com/fu037.htm
    For multiMedia
    /people/thomas.jung3/blog/2005/05/11/using-classic-activex-controls-in-the-abap-control-framework
    Uploading LOGO in SAP
    http://www.sap-img.com/ts001.htm
    LSMW
    http://www.sap-img.com/sap-data-migration.htm
    http://www.sapgenie.com/saptech/lsmw.htm
    http://sapabap.iespana.es/sapabap/manuales/pdf/lsmw.pdf
    http://www.sap.info/public/INT/int/glossary/int/glossaryletter/Word-17643ed1d6d658821_glossary/L#Word-17643ed1d6d658821_glossary
    OOPS ALV
    OOPS - Events.
    Editable ALV
    Tree
    TabStrip
    Multigrid
    Check this for basic concepts of OOPS
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
    Tabstrip
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20for%20tab%20strip%20in%20alv.pdf
    Editable ALV
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20edit%20alv%20grid.doc
    Tree
    http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_usrint.htm
    General Tutorial for OOPS
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf
    Function Module
    http://www.geocities.com/victorav15/sapr3/abapfun.html
    Smartforms
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/ccab6730-0501-0010-ee84-de050a6cc287
    https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/8fd773b3-0301-0010-eabe-82149bcc292e
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/3c5d9ae3-0501-0010-0090-bdfb2d458985
    Table Control
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/table%20control%20in%20abap.pdf
    Regards,
    Prasant
    *reward if helpful

  • How do I compare these text files (aka spell check)

    I'm having the hardest time figuring out how to get this spell check to work. Basically, I need to open the dictionary.txt file and then another file which will be spell checked. Ignoring case sensitivity, punctuation, and word endings (such as ly, ing, s). And then output to the user the words that were not found in the dictionary. Here is what I have so far (and it is very basic.... there is no attempt to compare yet since I don't know how to approach this). I only have it outputting to a JTextArea what is opened minus punctuation and upper case....
    import java.util.Scanner;
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    //  Created Sept 4, 2004
    *   @version 1.0
    *   This program will store dictionary.txt to a String array and
    *   open another text file to be specified by the user of the program.
    *   As the scanner proceeds through the document, it will spell check
    *   and output any (case insensitive) words not found in the
    *   dictionary.txt file.
    public class Spell extends JFrame {
        /** Area to place the individual words in the file */
        JTextArea outputDictionary, outputWord;
    *  Constructor for the class.  Sets up the swing components.
    *  Prompts the user for the files to be processed.  Then invokes
    *  the process method to actually do the work.
    public Spell() {
         // A JTextArea is used to display each word found in the file.
         outputDictionary=new JTextArea("Dictionary List\n\n");
         add (new JScrollPane(outputDictionary));
         //Set the size to 300 wide by 600 pixels high
         setSize(300,600);
         setVisible(true);
            outputWord=new JTextArea("Opened Document\n\n");
            add (new JScrollPane(outputWord));
            setSize(300,600);
            setVisible(true);
        //Prompts user for the dictionary.txt file
        JFileChooser dictionary = new JFileChooser();
        int returnVal = dictionary.showOpenDialog(this);
         if  (returnVal == JFileChooser.APPROVE_OPTION) {
              storeDictionary(dictionary.getSelectedFile());
        //Prompt user to open file to be checked          
        JFileChooser word = new JFileChooser();
        int returnVal2 = word.showOpenDialog(this);
            if (returnVal2 == JFileChooser.APPROVE_OPTION){
                storeOpenFile(word.getSelectedFile());
    public void storeDictionary(File dictionaryFile) {
         String dictionary="";
         Scanner scanner=null;
        try {
            // Delimiters specifiy where to parse tokens in a scanner
           scanner = new Scanner(dictionaryFile).useDelimiter("\\s*[\\p{Punct}*\\s+]\\s*");
        catch (FileNotFoundException fnfe) {
            JOptionPane.showMessageDialog(this,"Could not open the file");
           System.exit(-1);
         while (scanner.hasNext()) {         
              dictionary=scanner.next();
              if (!dictionary.equals(""))
                 outputDictionary.append(dictionary.toLowerCase()+"\n");
            System.out.println("Thank you, your dictionary is stored.");
    public void storeOpenFile(File openFile){
        String word="";
        Scanner scanner2 = null;
        try {
            // Delimiters specifiy where to parse tokens in a scanner
           scanner2 = new Scanner(openFile).useDelimiter("\\s*[\\p{Punct}*\\s+]\\s*");
        catch (FileNotFoundException fnfe) {
            JOptionPane.showMessageDialog(this,"Could not open the file");
           System.exit(-1);
        //stores the words in the opened text file in a String array
         while (scanner2.hasNext()) {         
              word=scanner2.next();
                 if(!word.equals(""))
                        outputWord.append(word.toLowerCase()+"\n");
        System.out.println("Thanks, your file has successfully been opened.");
    public static void main(String args[]) {
       Spell spellck = new Spell();
       spellck.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

    Yes, he actually recommends us to use java 1.5. I have revised my code to read into a TreeSet from the dictionary.txt, but I keep getting the following error when I compile:
    Note: C:\Jwork\spell1.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    Finished spell1.
    Also, when I execute, nothing happens. It looks like it is going to try to do something, but the "open" dialog box never opens and no errors pop up. It just sits there executing. Any suggestions??
    here is the code:
    import java.util.*;
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    //  Created Sept 4, 2004
    *   @version 1.0
    *   This program will store dictionary.txt to a String array and
    *   open another text file to be specified by the user of the program.
    *   As the scanner proceeds through the document, it will spell check
    *   and output any (case insensitive) words not found in the
    *   dictionary.txt file.
    public class spell1 extends JFrame{
        JTextArea output = new JTextArea(500,500);
        Set dict = new TreeSet();
        Set file = new HashSet();
        public spell1(){
        Set dict = new TreeSet();
        Set file = new HashSet();
        //Prompts user for the dictionary.txt file
        JFileChooser dictionary = new JFileChooser();
        JFileChooser wordFiles = new JFileChooser();
        int returnVal = dictionary.showOpenDialog(this);
         if (returnVal == JFileChooser.APPROVE_OPTION) {
         storeDictionary(dictionary.getSelectedFile());
        int returnVal2 = wordFiles.showOpenDialog(this);
            if (returnVal2 == JFileChooser.APPROVE_OPTION){
                storeFile(wordFiles.getSelectedFile());
        public void storeDictionary(File dictionaryFile){
            String dictionary="";
         Scanner scanner=null;
        try {
           // Delimiters specifiy where to parse tokens in a scanner
           scanner = new Scanner(dictionaryFile).useDelimiter("\\s*[\\p{Punct}*\\s+]\\s*");
        catch (FileNotFoundException fnfe) {
            JOptionPane.showMessageDialog(this,"Could not open the file");
           System.exit(-1);
         while (scanner.hasNext()) {
              if (!dictionary.equals(""))
                 dict.add(scanner.next());
            System.out.println("Thank you, your dictionary is stored.");
        public void storeFile(File wordFile){
            String word="";
            Scanner scanner2=null;
        try{
            scanner2 = new Scanner(wordFile).useDelimiter("\\s*[\\p{Punct}*\\s+]\\s*");
        catch (FileNotFoundException fnfe){
            JOptionPane.showMessageDialog(this,"Could not open the file");
            System.exit(-1);
            while(scanner2.hasNext()){
                if(!word.equals(""))
                    file.add(scanner2.next());
        public static void main(String args[]){
            spell1 spellck = new spell1();
            spellck.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

  • Removing punctuation from the beginning and end of a string

    I am working on a project for a "spell checking" program. So far the StringHash class is made, and the dictionary is read into a hash table. Then the document to be checked is specified via command line, the document scans through each word and checks to see if it is in the dictionary, if it is do nothing, if it is not then display it to console. The problem I am having is with a method in the main class. The method (I will post what I have so far) is called removePunct. The method should remove any punctuation from the beginning and the end of the string, nothing from the middle. Here is what I have so far:
    public static String removePunct(String word){
              StringBuilder wo = new StringBuilder(word);
              int x = (word.length()-1);
              if(!Character.isLetter(wo.charAt(0)))
                   wo.deleteCharAt(0);
              if(!Character.isLetter(wo.charAt(x)))
                   wo.deleteCharAt(x);
              return wo.toString();
    Any help would be much appreciated, I'm pretty certain the solution is either something completely different, or something so simple that I just missed it.

    The easiest way to do this is to just show you the actual file to be spell checked:
    -- outline --
    This directory contains Bison skeletons: the general shapes of the
    different parser kinds, that are specialized for specific grammars by
    the bison program.
    Currently, there are only three supported skeletons:
    - yacc.c
    It used to be named bison.simple: it corresponds to C Yacc
    compatible LALR(1) parsers.
    - lalr1.cc
    Produces a C++ parser class. It is still very experimental, and not
    yet supported. Please, subscribe to [email protected].
    - glr.c
    A Generalized LR C parser based on Bison's LALR(1) tables.
    These skeletons are the only ones supported by the Bison team.
    Because the interface between skeletons and the bison program is not
    finished, we are not bound to it. In particular, Bison is not
    mature enough for us to consider that ``foreign skeletons'' are
    supported.
    Copyright (C) 2002 Free Software Foundation, Inc.
    This file is part of GNU Bison.
    GNU Bison is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2, or (at your option)
    any later version.
    GNU Bison is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.
    You should have received a copy of the GNU General Public License
    along with Bison; see the file COPYING. If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
    What I need the spell checker to do is read each word, and strip any beginning or ending punctuation, e.g. (c) would become c. Pretty much punctuation consists of anything that is not a letter, hence the use of isLetter. I can easily modify the method to remove all punctuation using regular expressions, but I only want the beginning and end characters removed.
    Example of words:
    -yacc.c would become yacc.c and is not in the dictionary so it would be printed.

  • Hashtable containsKey() problem when String key is read from a file - HELP

    I'll try to be brief:
    I open a .txt file of Unicode encoding (not ANSI) in order to fetch some info.
    After I manipulate each line with splits etc I use a String as a key to a Hashtable.
    The problem is that later inside my code, I try to check wether this key (and hence its corresponded value) exists and I get a false value from the containsKey() method.
    and here's the code (I have embedded some comments //-type that address to this thread):
    FileInputStream fis = new FileInputStream(initFilename);
    InputStreamReader isr = new InputStreamReader(fis, "UTF-16");
    BufferedReader br = new BufferedReader(isr);
    lineText = loadSubiPhraseFilter(br);
    //In the loadSubiPhraseFilter method
    //parsing an input like this:
    //&#948;&#972;&#958;&#945; &#964;&#974; &#920;&#949;&#974;,1:1,2:2
    //Yeah, I know, its all greek to you ;)
    //Thus we first split the line with ','
    //we split the first token with ' ' and each one of the N words,
    //serves as an index in a N-dimension hashtable
    //This is achieved implicitly by adding another hashtable as a value to a String key etc...
    //When all words are added, the hashtable which contains the last word is used
    //to put another hashtable whose only key is the String "Index"
    //which points to the rest of the data. The thing is, I never get that far...
    //I dont get to even get a positive containsKey() when giving an inserted key at a later time
    //here's the loading procedure
    while((lineText = br.readLine()) != null && (lineText.charAt(0) != '#'))
         String [] info = lineText.split("[,]");
         /*Load subi indeces in a vector*/
         Integer [][] subiIndex = new Integer [info.length-1][2];// = new Vector<Integer>();
         for(int i = 1; i < info.length; i += 1)
              //load subiIndex here...
         /*Then fetch phrase to be modified and load its 'n' words in an n-dimesion hash which will utterly point to the subi indeces*/
         /*Starting from the last word, we  put the index vector*/
         String [] word = info[0].split("[ ']+");
         Hashtable<String, Object> nextWord = new Hashtable<String, Object>();
         nextWord.put("Index", subiIndex);
         /*Then we create a chain of hash dimensions corresponding to phrase words*/
         for(int i = word.length-1; i >= 0; i -=1)
              Hashtable<String, Object> prevWord = new Hashtable<String, Object>();
              //Yeah, I even tried the .trim() method...
              prevWord.put(word.trim(), nextWord);
              nextWord = prevWord;
              System.out.print(word[i] + "<-");
         /*We update the hash head and also add the first word with its first letter capitalized as key pointing to the same next key in hash dimension chain*/
         subiPhraseFilter = nextWord;
         subiPhraseFilter.put((capitalMap.get(word[0].charAt(0))+word[0].substring(1)).trim(), subiPhraseFilter.get(word[0]));
         //The following debbuging print outs work just fine. Its only just later when I cant get a containsKey()...
         System.out.println("|| "+subiPhraseFilter);
         System.out.println("subiPhraseFilter.containsKey("+word[0]+"): "+subiPhraseFilter.containsKey(word[0]));
    //Then the following code is executed
    Integer [][] subiPhraseIndeces(String word1, String word2, String word3)
         String [] tmp = {word1, word2, word3};
         Hashtable<String, Object> dimension = subiPhraseFilter;
         //The following debbuging print out does NOT return true
         //even when I explicitly give a String key which I know it is inserted
         System.out.println("subiPhraseFilter.containsKey(" + tmp[0] + "): " + subiPhraseFilter.containsKey("&#949;&#957;&#955;&#972;&#947;&#969;".trim()));
         for(int i = 0; (i < tmp.length) && (tmp[i] != null) && dimension.containsKey(tmp[i]); i += 1)
              //This is NEVER executed...
              System.out.println(i + ": dimension.containsKey(" + tmp[i].trim() + ")");
              dimension = (Hashtable<String, Object>)dimension.get(tmp[i].trim());
              return (Integer [][])dimension.get("Index");
    Whats most irritating is that this also happens arbitrarily in another place of my code where I load again info by using each line as a key to another Hashtable and, the containsKey() method returns true to all but one (!) line-words, even if I change its position in the file. I won't put the latter code here because its just very simple. (in case I wasnt clear I read a section of a file that looks like
    wordA
    wordB
    wordC
    wordN
    each wordX is put as a key to a Boolean value and yet, containsKey(wordA) returns false even if i change the input file to
    wordB
    wordA
    wordC
    wordN
    isn't that just peculiar?
    A significant note in this problem is that I do not read english characters, rather than greek (hence the unicode filetype) which I put as keys to the hashtable; later I try to get corresponded values by fetching text (which I also manipulate) from a JTextfield, as key, and I'm afraid that maybe something is happening there.
    However the code sample I added above didnt work even when I added an english word in the file and explicitly asked wether it is contained as a key...
    Maybe I am doing something I really can't see right now...
    Help would be appreciated                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    BalusC: "I would also not be surprised if that file is after all actually just UTF-8"
    No, it's not cause I explictly saved the .txt file as Unicode in wordpad and NOT as UTF-8. By the way notepad has ANSI as its default save-type.
    However I converted my input files to UTF-8 and read them using the "UTF-8" String flag in the constructor of the reader I was using. All the same.
    EDIT: Not to metion, the UTF-8 file needed an empty line at the beggining or my parsing would skip the first line, messing everything up!
    Just for the sake of it I will show the output of my program (redirected to a file cause cmd.exe does not support greek letters, or I didnt find a way to make it so):
    (This is the output when I load from the UTF-8 file the word "&#949;&#957;&#955;&#972;&#947;&#969;" in my has as a key (pointing to a Boolean i think - it doesnt really matter). What I print is the key of each dimension of the hash -here there's only one dimension- and then I print the hash reference, i.e like a toString() representation. The result shows that the Hashtable contains at key "&#949;&#957;&#955;&#972;&#947;&#969;" a value which is another Hashtable which contains the key "Index" pointing to something you shouldnt care. The hash head also contains the key "&#917;&#957;&#955;&#972;&#947;&#969;", which is actually the same as before only to have its first letter capitalized, which in turn points to a hash with one key etc...)
    &#949;&#957;&#955;&#972;&#947;&#969;<-|| {&#949;&#957;&#955;&#972;&#947;&#969;={Index=[[Ljava.lang.Integer;@360be0}, &#917;&#957;&#955;&#972;&#947;&#969;={Index=[[Ljava.lang.Integer;@360be0}}
    subiPhraseFilter.containsKey(&#949;&#957;&#955;&#972;&#947;&#969;): true
    (And later on I get a string from a JTextField I tokenize it and here's what I get when I reach the same word:)
    (Don't mind "Checking: ..." its 'cause I check a window of three words in order to reach up to a 3-dimension hash key. Yet I dont even get the first key!)
    Current token: '&#949;&#957;&#955;&#972;&#947;&#969;'
    Checking: &#949;&#957;&#955;&#972;&#947;&#969;, null, null
    subiPhraseFilter.containsKey(&#949;&#957;&#955;&#972;&#947;&#969;): false
    Now isn't that making one crazy?
    Any other ideas?
    Thnak you in advance!
    P.S. In case that I haven't done something really stupid which is ommitted here and yet can't be tracked, I think the problem must be somewhere between the encoding of JTextField and the encoding I read...
    P.S.2 Excuse me for saying hash instead of Hashtable sometimes in the above text
    Edited by: M.M. on Sep 2, 2009 3:22 AM
    Edited by: M.M. on Sep 2, 2009 3:23 AM

  • Cipher program.. in need of a little guidance

    I understand I posted many messages about this subject. But I just wanted to start a new thread on this as a whole. I apologize for that. Anyways I can't get this thing going right... I want to take a repeating key and encode words with it. This program takes text files and the first line is all ints (the repeating keys) and the next lines are ones to be encoded and decoded.
    I left a big comment on what I need to do and also if you see any obvious problems please let me know. I really appreciate it. Thanks.
    import java.io.*;
    import java.util.*;
    public class RepeatingKeyCipher<E>
       public static void main(String[] args) throws IOException
            RepeatingKeyCipher obj = new RepeatingKeyCipher();
            File file = new File("in.dat");
            PrintWriter outFile = new PrintWriter(new FileWriter("out.dat"));
              Scanner fileIn = new Scanner(file);
              Queue<Integer> keyNumbers = new LinkedList<Integer>();
              Queue<String> plainText = new LinkedList<String>();
              int keyLine;
              while(fileIn.hasNextInt())
                   keyLine = fileIn.nextInt();
                   plainText.offer(keyLine);
              keyNumbers.offer(plainText.poll());
              Queue<String> cipher = new LinkedList<String>();
              cipher = obj.encode(keyNumbers, plainText);
              //for(int i = 0; i < message.length; i++) {
         private int front;
         private int rear;
         private int size;
         private char newLetter;
         private String alpha = "abcdefghijklmnopqrstuvwxyz";
         public char encode (Queue<E> key, Queue<E> plain)
         {//returns new letter
            /* From here on you just find a way to seperate the key element.
                 Then you seperate the first character from the plain queue.
                   Then use the nested loops to convert and add back to a third
                   queue. */
            Queue<String> encodedText = new LinkedList<String>;
              StringTokenizer st = new StringTokenizer(message);
              while(st.hasMoreTokens())
                   String word = st.nextToken();
                   int wordLength = word.length();
                   for (int i = 0; i < wordLength; i++)
                         newLetter = alpha.charAt(i + key);
                         if (newLetter > alpha.length())
                             newLetter =alpha.charAt((i + key) - 25);
                             return newLetter;
    }

    Most of those question will have to be answered by your O2 UK customer service, as they will know their data plans.
    But for the BlackBerry, you will need a BlackBerry specific data plan.
    Just a generic internet access plan usually will not suffice.
    So when you speak to them, make sure you get specific BlackBerry data plan information, add-on or bolt-on or whatever the call it.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Problem with recursive function & Exception in thread "AWT-EventQueue-0"

    I hope that title doesn't put everyone off :)
    I have a recursive function that takes in a list of words, and a reference to my current best board. I am kludging the escape function +(tryWords.size() == 0 || mTotalBlankBlocks < 200)+ atm, but eventually it will escape based on whether the current bestBoard meets certain requirements. The function makes iterates through a list of words, and finds all the spaces that the word would fit into the puzzle: getValidSpacedPositions(currentWord); - it then iterates through each of these; placing a word, removing that word from the iterator and the relevant arrayLists and then recurses the function and tries to do the same with the next word etc.
    private void computeBoards(ArrayList<Word> tryWords, Board bestBoard) {
         if (tryWords.size() == 0 || mTotalBlankBlocks < 200)
              return;
         for(Iterator<Word> iter = tryWords.iterator(); iter.hasNext(); ){
              Word currentWord = new Word();
              currentWord = iter.next();
              ArrayList<Position> positions = new ArrayList<Position>();
              positions = getValidSpacedPositions(currentWord);
              if (positions.size() != 0)
                   iter.remove();
              System.out.println();
              int placedWordsIndex = tryWords.indexOf(currentWord);
              System.out.print(placedWordsIndex+". "+currentWord.getString()+" with "+positions.size()+" positions / ");
              for (Position position : positions) {
                   System.out.println("Pos:"+(positions.indexOf(position)+1)+" of "+positions.size()+"  "+position.getX()+","+position.getY()+","+position.getZ());
                   int blankBlocksLeft = placeWord(currentWord, position);
                   if(blankBlocksLeft != 0)
                        mPlacedWords.add(currentWord);
                        // TODO: Kludge! Fix this.
                        mUnplacedWords.remove(placedWordsIndex+1);
                        System.out.println("adding "+currentWord.getString()+" to added words list");
                        Board compareBoard = new Board(blankBlocksLeft, mPlacedWords.size());
                        if (compareBoard.getPercFilled() > bestBoard.getPercFilled())
                             bestBoard = new Board(blankBlocksLeft, mPlacedWords.size());
                        //**RECURSE**//
                        computeBoards(tryWords, bestBoard);
                        mUnplacedWords.add(currentWord);
                        removeWord(currentWord);
                        System.out.println("removing "+currentWord.getString()+" from added words list");
                   else
                        System.out.println("strange error, spaces are there but word cannot place");
              System.out.println("**FINISHED ITERATING POSITIONS");
         System.out.println("**FINISHED ITERATING TRYWORDS");
    }This all seems to work fine, but I add it in for completeness because I am not sure if I have done this right. The Exception occurs in the placeWord function which is called from the recursive loop, on the line bolded. For some reason the Arraylist Words seems to initialise with size 1 even though it is a null's when I look at it, (hence all the redundant code here) and I can't seem to test for null either, it seems to works fine for a while until the recursive funciton above has to back up a few iterations, then it crashes with the exception below.
         private int placeWord(Word word, Position originPosition) {
              ArrayList<Word> words = new ArrayList<Word>();
              switch (originPosition.getAxis().getCurrInChar()) {
              case 'x':
                   // TODO: This is returning ONE!!!s
                   words = mBlockCube[originPosition.getX()][originPosition.getY()][originPosition.getZ()].getWords();
                   int tempword1 = mBlockCube[originPosition.getX()][originPosition.getY()][originPosition.getZ()].getWords().size();
                   for (int i = 0; i < word.getLength(); i++) {
                        *if (words.get(0) == null)*
                             mBlockCube[originPosition.getX() + i][originPosition.getY()][originPosition.getZ()] = new Block(word, word.getChar(i));
                        else
                             mBlockCube[originPosition.getX() + i][originPosition.getY()][originPosition.getZ()].addWord(word);
                   break;
              case 'y':
                   words = mBlockCube[originPosition.getX()][originPosition.getY()][originPosition.getZ()].getWords();
                   int tempword2 = mBlockCube[originPosition.getX()][originPosition.getY()][originPosition.getZ()].getWords().size();
                   for (int i = 0; i < word.getLength(); i++) {
                        *if (words.get(0) == null)*
                             mBlockCube[originPosition.getX()][originPosition.getY() + i][originPosition.getZ()] = new Block(word, word.getChar(i));
                        else
                             mBlockCube[originPosition.getX()][originPosition.getY() + i][originPosition.getZ()].addWord(word);
                   break;
              case 'z':
                   words = mBlockCube[originPosition.getX()][originPosition.getY()][originPosition.getZ()].getWords();
                   int tempword3 = mBlockCube[originPosition.getX()][originPosition.getY()][originPosition.getZ()].getWords().size();
                   for (int i = 0; i < word.getLength(); i++) {
                        *if (words.get(0) == null)*
                             mBlockCube[originPosition.getX()][originPosition.getY()][originPosition.getZ() + i] = new Block(word, word.getChar(i));
                        else
                             mBlockCube[originPosition.getX()][originPosition.getY()][originPosition.getZ() + i].addWord(word);
                   break;
              mTotalBlankBlocks -= word.getLength();
              word.place(originPosition);
              String wordStr = new String(word.getWord());
              System.out.println("Word Placed: " + wordStr + " on Axis: " + originPosition.getAxis().getCurrInChar() + " at pos: "
                        + originPosition.getX() + "," + originPosition.getY() + "," + originPosition.getZ());
              return mTotalBlankBlocks;
    Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
         at java.util.ArrayList.RangeCheck(Unknown Source)
         at java.util.ArrayList.get(Unknown Source)
         at com.edzillion.crossword.GameCube.placeWord(GameCube.java:189)
         at com.edzillion.crossword.GameCube.computeBoards(GameCube.java:740)
         at com.edzillion.crossword.GameCube.computeBoards(GameCube.java:763)
         at com.edzillion.crossword.GameCube.computeBoards(GameCube.java:763)
         at com.edzillion.crossword.GameCube.computeBoards(GameCube.java:763)
         at com.edzillion.crossword.GameCube.computeBoards(GameCube.java:763)
         at com.edzillion.crossword.GameCube.computeBoards(GameCube.java:763)
         at com.edzillion.crossword.GameCube.computeBoards(GameCube.java:763)
         at com.edzillion.crossword.GameCube.computeBoards(GameCube.java:763)
         at com.edzillion.crossword.GameCube.computeBoards(GameCube.java:763)
         at com.edzillion.crossword.GameCube.computeBoards(GameCube.java:763)
         at com.edzillion.crossword.GameCube.computeBoards(GameCube.java:763)
         at com.edzillion.crossword.GameCube.computeBoards(GameCube.java:763)
         at com.edzillion.crossword.GameCube.computeBoards(GameCube.java:763)
         at com.edzillion.crossword.GameCube.computeBoards(GameCube.java:763)
         at com.edzillion.crossword.GameCube.computeBoards(GameCube.java:763)
         at com.edzillion.crossword.GameCube.computeBoards(GameCube.java:763)
         at com.edzillion.crossword.GameCube.computeBoards(GameCube.java:763)
         at com.edzillion.crossword.GameCube.computeBoards(GameCube.java:763)
         at com.edzillion.crossword.GameCube.computeBoards(GameCube.java:763)
         at com.edzillion.crossword.GameCube.generateGameCube2(GameCube.java:667)
         at com.edzillion.crossword.GameCube.<init>(GameCube.java:42)
         at com.edzillion.crossword.Crossword.actionPerformed(Crossword.java:205)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    Any ideas? I've looked up this exception which didn't shed any light...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    ArrayList<Word> words = new ArrayList<Word>();See the API Javadoc for ArrayList: this creates an empty ArrayList.
    if (words.get(0) == null)This tries to read the first element of the (still empty) array list -> throws IndexOutOFBoundsException
    If you want to stick to that logic (I am too lazy to proof-read your whole algorithm, but that should at least unblock you), you should first check whether the list actually contains at least one element:
    if (!words.isEmpty()) {...}

Maybe you are looking for

  • Palm! Where can I find a fully-functional Pre Plus????

    Yes, I've posted this in a sub-topic and now I'm creating a new thread because I've had enough!  I once considered myself a big time Palm supporter - but I do not know how much more I can keep my head up with this Pre Plus. I'm spending WAY too much

  • How to Revoke an older request of an ABAP program

    Dear All, I wish an older version (before the last three modifications) of my ABAP program to be revoked on the production server. In other words I wish an older request of my current program to overwrite the current request, in between these two req

  • Adding Content To the Top-Level of Navigation bar ?

    Hi,experts ,    i have a problem with adding content to the top-level of navigation bar ? I have the authority of administration.I have added a customizing role with the entry-point property to myself userid . I have checked my navigation-target page

  • Intel finds errors in Sandy Bridge chipset

    I just saw this announcement that Intel has found design flaws in the new Sandy Bridge chipset and it looks like there will be a recall. I just bought a Satellite A660 with the i7-2630qm which has the Intel 6 series chipset in question. What a disapp

  • M40-237: small lines from top to bottom on the screen

    I have installed DirectX 9c Feb 2006. When I'm Trying to play a game , in the center of the screen there are small horz. lines from top to bottom. How can I solve this problem ? Thanxs.