-1
votes
4answers
46 views

How do I remove an element from an array in Java? And how do I skip null array elements?

I'm working through a class assignment and I'm not sure how to remove an element from an array. I've read suggestions to use ArrayUtils or convert the array to a linked list. I'm still very new to ...
1
vote
3answers
49 views

String Split null value in to array to use if statement

Here's the scenario. User enters 3 types of inputs: 1/1/2013 12:00:00 AM_5/31/2013 12:00:00 AM 1/1/2013 12:00:00 AM_ _5/31/2013 12:00:00 AM The input is for date range query. 1st input: Split by ...
2
votes
3answers
52 views

How to turn an ArrayList with Object[]'s into an Object[][] array? [duplicate]

I have an ArrayList with Object[]'s and I need to convert the ArrayList into an Object[][] array in order to put the data in a JTable. How can I do this? I have tried: (Object[][]) ...
0
votes
2answers
55 views

How to create objects from a text file? [closed]

I have a text file of information that I want to make into Objects. The text file looks like this: mediterraneanAvenue 60 0 50 {2, 10, 30, 90, 250} 0 balticAvenue 60 0 50 {4, 20, 60, 180, 450} 0 ...
0
votes
2answers
53 views

Array Clone doesn't work

what is wrong with my code? in the main method i am doing this: int [] test=new int[48]; test=etable(Right[]).clone(); What i want is, that the 'test' array is exactly the same like the output ...
0
votes
2answers
69 views

How do i save a value from an object array in java?

I'm a starting programmer and i can't seem to find my mistake in my code. I have an arraylist of objects(persons) and I want to save the value of an index into a variable: public void ...
0
votes
1answer
34 views

accessing a method in an array of objects that are in an array of objects

How do I access an array of objects inside of an array of objects? my code: private boolean intersect(Polygon[] polygons, Line[] the_path, int i, int j) { int k = 0; boolean intersect; ...
0
votes
2answers
50 views

Array-array index by value

I have the following variables: byte[][] bytes; byte[] value; Is there a smart way to find the index of the first matching entry of value in bytes ? value is NOT the same object as an entry in ...
0
votes
2answers
41 views

Can't cast methods from a cloned array

I am trying to cast methods from a cloned array. However, I'm experiencing some issues. Here's the code: Array1[] a = new Array1[] { "new Array1("exampletext", 0.5, 205) }; ...
5
votes
4answers
64 views

Java Finalizers, what tasks are really necessary

ArrayList<Object> foo; Object[] bar; typical finalizers will do foo = null; bar = null; My question, will ArrayList call a finalizer wich sets any pointers it holds to null, or do I have to ...
-7
votes
0answers
29 views

having NPE in this section, does anyone knows why it hapens, and what exactly NPE is [closed]

having NPE in this section, does anyone knows why it hapens, and what exactly NPE is /** * this method returns the number of actual trips the company have * * @param - no parameter is given to ...
2
votes
4answers
76 views

Storing 15,000 items in Java

I have a document with 15,000 items. Each item contains 6 variables (strings and integers). I have to copy all of these into some sort of two dimensional array, what the best way to do it? Here are ...
0
votes
3answers
49 views

implementing quick sort only on one half of the array

I have an excercise in which I have to improve an algorithem. This algorithem takes an array and puts the evens in the left side (SORTED) and the odds in the right side (NOT-SORTED). The algorithem is ...
5
votes
3answers
80 views

Is there any way to make an ordinary array immutable in Java?

Googled for it, found plenty of code. But any of them gave me what I want. I want to make an ordinary array Immutable. I tried this: import java.util.ArrayList; import java.util.Collections; import ...
0
votes
4answers
46 views

Java Error, required: char[] found char

I have made a character array in Java, char[] letterGrade = { 'A','B','C','D','F'}; and am trying to reference the elements like this, letterGrade[0] I am getting an error that says incompatible ...
-1
votes
2answers
53 views

Print sorted array [closed]

I need to print the sorted array. Everything else is perfect. What is the best way to do this.? a new method? thanks for the help in advance! import java.util.Scanner; public class hw3 { public ...
-1
votes
4answers
62 views

printing a two dimensional matrix (array) java

I need to print this in the correct two dimensional array format. SOmething is wrong. Need the print from the method. My output is what seems to be an infinite loop. import java.util.Scanner; public ...
0
votes
1answer
59 views

java two dimensional array sorting

Write a program that prompts the user to enter a nxn matrix of double values and displays a new matrix which has the columns of the initial matrix sorted. You may use any sorting algorithm to solve ...
0
votes
3answers
50 views

java.lang.ArrayIndexOutOfBoundsException Error

How do I fix this error and what does it mean? java.lang.ArrayIndexOutOfBoundsException: 5 at Sort.sort(Sort.java:29) at Sort.<init>(Sort.java:13) at ...
0
votes
1answer
13 views

Read empty cells from the table JTable into the array

I need to read data from the table JTable. The problem is that this table may contain empty cells. In this case the error message is: Exception in thread "AWT-EventQueue-0" ...
5
votes
2answers
76 views

Writing byte array to file. Not always getting expected result

I am using Java to write a byte array to a file. When I open my file in a hex editor I am not always seeing the bytes that I expected to be there. Here is my example code and contents of the output ...
1
vote
2answers
64 views

Want to get element in ArrayList with a list of ids

I have an ArrayList, each UIToto contains (String id, String name, String info) for example (4546-fdsf4545sfd-dfs545, titi, female) (dqs4d65q4-45d4s54545sfd-dfss54545, tutu, male) I have a list of ...
0
votes
5answers
61 views

Search for a pattern in Java String arrays

I have a string array in Java like this. new String[] { "A", "AAD", "AC", "B" }; I want to search for a pattern like starts with 'A' and get back result in a array for all the items in the array ...
0
votes
3answers
46 views

How would i fix this Error java.lang.Object[] cannot be cast to java.lang.String[]?

Im not to sure how to fix this since my code is String[] and not Object[] How would i go about fixing this error? Here is s the full logcat: 06-14 00:25:40.356: W/dalvikvm(13023): threadid=1: thread ...
-1
votes
0answers
33 views

java.sql.Array.getArray white space

I have a Java EE web application running in struts and using hibernate. The application is using PostgreSQL for DB I have a problem with whie space characters when calling the Array.getArray ...
2
votes
5answers
47 views

Java - Change values of an array by a method in a Class

Here is my code: class Myclass { private static int[] array; public static void main(String[] args) { Myclass m = new Myclass(); for (int i = 0; i < 10; i++) { ...
2
votes
2answers
74 views

Java Array - NullPointerException [closed]

Here is the code (including both classes): import java.util.Scanner; import java.util.Random; public class SortedArray { public int [] myNums; public int sizeOfArray; private int ...
1
vote
1answer
44 views

Most efficient way to join two object arrays

This object is what it is all about: public class Unit { private String label; NumberRow numberRow; Unit(String label){ this.label=label; numberRow = new NumberRow(); } .... } It ...
2
votes
2answers
78 views

unexpected results when checking if two arrays are equals in Java

import java.util.Scanner; import java.util.Arrays; class Test { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter the amount of ...
0
votes
1answer
42 views

Multiple Paths in a Text Game

https://github.com/addrum/TextGame So I have this game. What I have achieved so far is that if the user inputs a correct response it returns the next message for them to then figure out what to do ...

1 2 3 4 5 239
15 30 50 per page