Tagged Questions
3
votes
2answers
68 views
Sorting a 2d String Array in Java
I created a 2d-array in Java for a project that reads in a file, processes the data, and the prints it back out. The only problem I am having is trying to sort the 2d-array alphabetically.
This is an ...
-2
votes
1answer
40 views
Java Scanner and Multidimensional Arrays [closed]
I'm having some trouble figuring out why this isn't working. Any ideas?
try {
Scanner scanner = new Scanner(new File("/Users/xxxxxxx/Desktop/baseball_in.txt"));
String[][] ...
0
votes
3answers
60 views
java two-dimensional array, how do I remove selected rows
I really new to java and I've Googled this in every possible phrase i know how.
So I have a table made of 36 rows and 12 columns, I've been trying to write a method that will delete the a row when ...
0
votes
3answers
42 views
Number of columns in 2d array declaration
I want to read a text file and insert it into a 2d array. Here is my code.
List<String> list2 = new ArrayList<String>();
String thisLine = null;
while ((thisLine ...
0
votes
1answer
60 views
Multi-dimensional arrays: Variable length row?
It is possible to do variable length columns such as:
private int k[][] = new int[3][];
for(int i = 0; i < k.length; i++) {
k[i] = new int[i+1];
}
I was wondering if it was possible to do ...
0
votes
5answers
77 views
How can I transform a List of List (multidimensional List) to an Array of Array(multidimensional Array)?
I have written this code, but at run time I have this error:
[Ljava.lang.Object; cannot be cast to [[Ljava.lang.String;
please help me, thanks!!!
public java.util.List<String> ...
0
votes
2answers
49 views
Java Null Pointer Exception in multi dimensional array
Alrighty, First post here so yell at me if I'm doing something wrong but I have the following code, the attempt is to make a zone builder kind of deal for one of those old school circle mud's. ...
0
votes
1answer
47 views
How to sort a large text file's data into a multi-dimensional array?
I have a very large data file. It starts off with a big paragraph that I want to ignore or remove from the equation, then it has a year e.g. 1974, then 6 spaces, then a number to represent a month, ...
1
vote
2answers
36 views
How to get rid of text at the start of a string?
I have a text file, and it starts off with some text before getting to the data that I need for my program. How do I go about getting rid of this text and pick up only the data behind it?
The file ...
0
votes
1answer
32 views
How to map an array index to a certain date?
I want to map an index from my 3D array to a date. I have an array (sortedData[34][12][31]) and I would like to have it so that if a date is selected from JCalendar it corresponds to the correct index ...
2
votes
0answers
47 views
3d array An exception occurred processing JSP page
I'm trying to create a 3 dimensional array with some values from database, but I'm getting an error that doesn't tell me too much. Any idea what it can be?
db_pstackNr is a string formed by numbers ...
0
votes
2answers
42 views
How to sort a large text file into a multi-dimensional array?
I'm trying to read a large text file and sort it into a 3D array using scanner() but I don't think the array is being populated, and I keep getting the error java.lang.NullPointerException, but I ...
0
votes
2answers
46 views
(Android) Passing multidimensional array through intent
I want to pass a multidimensional array to an activity
multidimensional array:
double[][][] speed = new double[][][]
{
{
{ 15, 10 },
{ 16, 12 }
},
{
{ 14, 50 },
...
0
votes
2answers
37 views
Multidimensional Array Computation
I'm trying to compute the largest product amongst four adjacent numbers (integers) in a 20x20 grid.
This is what I have so far...
/**
* The maxProduct method is used to compute the largest product ...
2
votes
2answers
53 views
Concatenation of multidimensional string arrays in java
I wish to print the contents of String[][] myArray using only one print statement.
Obviously the array can be printed easily by looping through it, but for the sake of clean log files, I'd like the ...