2
votes
2answers
43 views

how to programm a 3 dimensional Matrix using ArrayList and Array

Here is my case, I would like to create a matrix buffer for a 3d project I am working on. Many people on stackoverflow is proposing doing something like this ...
-5
votes
1answer
37 views

Convert 2D array to string and back again in Java?

I need to store a 2d enum array in an sqlite database on Android so the easiest way seems to be to convert into a string (e.g. a CSV string) to store in the db and then back again when retrieving. ...
-5
votes
0answers
76 views

Java Inheritance [closed]

I have been working on this assignment for a while and cannot figure out why my variables will not pass properly. I am using a multidimensional array and think that it may be an initialization ...
0
votes
1answer
53 views

Passing array elements between different classes in Java

I am having trouble passing the elements in an array that holds names and numbers to another class where calculations will be done. This is what I have for the classes. public class Employee { ...
0
votes
3answers
33 views

display random pictures using java

I am trying to display random pictures based on Random() method's generation(just trying something like captcha). I am generating random no from an array, but dont know how to map these no's with ...
1
vote
7answers
66 views

Java data structure for reverse insert

Is there a datastructure in Java which supports reverse insert? I want to add values to a datastructure. I do not know how many in advance. The values should be inserted in the following row: ...
0
votes
2answers
42 views

Convert Signed Byte Array to Int array

I have an integer array int res[] = {176, 192, 312, 1028, 1064, 1016}; I get the signed byte array of the corresponding int array like this int signed_byte_array[] = {-80, 0, -64, 0, 56, 1, 4, 4, ...
0
votes
1answer
36 views

Move an item from one list/arraylist to another list/arraylist

How to move an item from one list/arraylist to another list/arraylist? Here's what I am required to do Add songs from a text field to a music library ArrayList. Select songs in the List Box and add ...
0
votes
6answers
47 views

How to create generic primitive arrays?

This is a following question coming from Two methods for creating generic arrays. With given two methods, @SuppressWarnings("unchecked") static <T> T[] array1(final Class<T> elementType, ...
0
votes
2answers
64 views

Combining array indexes

I have created two arrays. One to store names and one to store sales. I am trying to link the indexes of each together so that index 1 from then name array will bring up the value of index 1 of the ...
-4
votes
3answers
60 views

Accessing array at index 0 returnes correctly, but accessing at index 1+ generates error? [closed]

Here is the code: System.out.println("[Server] Handshake Recieved"); String fdata = new String(p.getData()); String[] data = fdata.split(";"); System.out.println(fdata); ...
4
votes
4answers
59 views

How can I treat an underlying byte array as an array of shorts? Or ints? Or longs?

I am an embedded engineer, working in Java. I need to communicate with devices, and frequently I need to massage buffers into the form needed by or produced by some hardware. I have spent ...
-1
votes
3answers
55 views

Java program using arrays, finding max int? [closed]

The Game class contains a main method that: (10 points) Checks to see if any names have been specified on the command line. If no names are specified, the method prints the message “No names ...
-2
votes
3answers
45 views

Exception in thread “main” java.lang.ArrayIndexOutOfBoundsException: 100 [duplicate]

I am building a project in java (with Netbeans) which is about classes. So i have this import javax.swing.*; public class TestHumanResourcesTEI { public static void main(String[] args) { final ...
0
votes
0answers
28 views

Assistance with Circular Extended Array Deque

I'm trying to implement a Deque utilizing a circular array that extends when the array gets full. However, I am getting an IndexOutOfBoundsException. I think my issue is with the insertLast method. ...
-1
votes
3answers
66 views

How can I see if part of a word is contained in an array? [closed]

For instance, let's say I have the following array of app names: {"Math Workshop", "Math Place", "Mathematics", "Angry Birds"} I want to scan this array for any elements that contains the word ...
0
votes
2answers
38 views

Array initalization using reflection

Someone please help to understand how can we initialize array in java using reflection. for a simple object we can do like this : Class l_dto_class = Class.forName(p_fld.getType().getName()); Object ...
-2
votes
3answers
106 views

Why values are not the same?

I have the following piece of code: public int[][][] arrMethod1(){ for (int idx=0;idx< x;idx++ ){ arr[idx]=arrMethod2(); System.out.println("arr "+idx+" is ...
0
votes
1answer
60 views

Find count of duplicate elements and create arrays of them

i have a list of elements in array like [121,122,121,122,123,121,122] output should be arrays of all the duplicate elements like [121,121,121] [122,122,122] [123] I am limited to use Java 1.4. ...
4
votes
3answers
88 views

Two methods for creating generic arrays

I've learned following two methods for creating generic arrays. One is @SuppressWarnings("unchecked") static <T> T[] array1(final Class<T> elementType, final int size) { return ...
2
votes
1answer
27 views

JFreeChart Bar Chart Production

I'm trying to create a bar chart that generates a dataset from within a for loop. String scores = scoreText.getText(); String[] data = scores.split(","); DefaultCategoryDataset barChartDataset = ...
-1
votes
2answers
44 views

Find TOP 10 words from text: 95%-working code [closed]

I start learn Java few month ago. For my homework I write this code - to find TOP 10 words from text file. For me it very interesting task. And hard. The third day I can't finish this software - I ...
0
votes
1answer
41 views

How can I get an element type class from an array type class?

Can I get Class<T> from Class<T[]>? public static <T> void doSometing(final Class<T[]> arrayType) { final Class<T> elementType; // = @@? } Or, can I get ...
0
votes
1answer
66 views

Array of objects within array of objects

I'm fairly new to Java and I'm having a bit of trouble completing an assignment. We are asked to create a program that takes information from companies (we are supposed to create at least three). ...
1
vote
1answer
68 views

JDK's Arrays vs. Guava's ImmutableList

Is there advanteges between using one-line list creation with com.google.common.collect.ImmutableList.of(...) and java.util.Arrays.asList(...) ?
1
vote
0answers
64 views

Print to file produces unwanted text

I have something like this: private void myPrinter(int[] arr) throws IOException{ FileWriter outFile = new FileWriter("myFile.txt",true); PrintWriter out = new PrintWriter(outFile); ...
0
votes
4answers
70 views

Index out of bounds exception error

I have the following code which appears to generate an array error on the following bit: int run = 0; while(myNet.RunNet(q) > 0.2 && run < 1000) { ...
1
vote
1answer
28 views

Formatting an array element

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 ...
0
votes
5answers
41 views

Parsing an Extra String to Check For Data

I have an extra which will be passed to my service as an extra and I need to check to see if it contains specific data but I'm not sure exactly how this is accomplished so I could use a hand in ...
1
vote
1answer
23 views

Simple ViewPager - Single Layout

I'm trying to do a simple ViewPager from an array of images. My array is: <string-array name="ot_images"> <item>"file:///android_res/drawable/ot_100.jpg"</item> ...

1 2 3 4 5 240
15 30 50 per page