0
votes
0answers
39 views

Best way to read data from large files in C++ to Java?

Im a beginner in JNI and Java. I have a JNI program which reads data from C++ files into Java. The C++ files belong to the Open Trace Format(OTF). The current JNI interface works fine, when I try to ...
0
votes
1answer
22 views

Sphere Online Judge, Problem 2: Prime Number Generator

I am trying to solve this problem on Sphere Online Judge. I keep getting a timeout error. Any comments or suggestions are welcome and appreciated. package info.danforbes.sphere; import ...
0
votes
0answers
43 views

How can I improve this OpenGL Code (LWJGL, Particles)

I wrote a small particle engine in Java for my Pong clone. I read that changing a texture is very expensive in OpenGL, so I tried to change the texture as few times as possible. Therefore I change the ...
2
votes
2answers
66 views

How to optimize this loop?

I am working on a Java program which creates a map using Voronoi. I am using a Java library which generates Voronoi and it is very fast (http://sourceforge.net/projects/simplevoronoi/). The problem I ...
3
votes
2answers
80 views

Java Array Traversal Optimization

I'm currently learning JAVA in a class and we're using the ACM Graphics package. I wanted some pointers on my code. To provide some context here is the assignment: Write a program that creates an ...
3
votes
1answer
61 views

How to improve Collision Detection in Bricks in BreakOut Game

I've done my first BreakOut Game while completing an assignment for Stanford University CS Online Course for java. However I noticed during play testing that when the ball sometimes hits a brick ...
1
vote
2answers
127 views

Email report generation from database

I have written a small batch job which will collect data from db and send mail to user. Can you please do a review of the code with design prinicples in mind and also with best practices for Db and ...
2
votes
1answer
85 views

TicTacToe in Java

I created this game in Java: import java.util.Scanner; public class TicTacToe { public static Scanner input = new Scanner(System.in); public static String getName(int noPlayer) { ...
1
vote
1answer
113 views

Playing Card Class - is this right?

The Art and Science of Java, a course book that uses the ACM library has an exercise that reads like this. Implement a new class called Card that includes the following entries: • Named ...
1
vote
1answer
132 views

Which code is better? And why?

I found two ways of writing the same program (one that only uses local variables, but no methods other than the main one) and other that uses one instance variable that is used in two methods. This ...
2
votes
2answers
120 views

How can I improve this coin flipping code?

I am doing exercises for the Art and Science of Java textbook. I had an exercise that required me to program the simulation of flipping a coin until 3 consecutive "Heads" result appeared. I did it, ...
1
vote
2answers
75 views

How to optimize this code?

So I have this piece of code in Java(Android) to add a list of brokers to a local SQLite database as one single sql instruction. public void Add(List<Broker> brokers) { if(brokers == null ...
1
vote
1answer
40 views

Improving the redundant code I have while inserting to Cassandra

I have started working with Cassandra database recently. And I was trying to insert some data into one of my Column Family that I have created. Below is the code by which I am trying to insert into ...
0
votes
1answer
64 views

Optimization: Eliminate conditional expression within common code

Background The following code (part of a natural language processor) was written to eliminate duplicate code by using isLeft as a conditional throughout the method: private void ...
0
votes
0answers
87 views

Optimization of Android code suggestions? Iteration based

At the "if(a==2)" part of my code below, the android emulator takes 8 seconds to process and display some data in a list. I need to reduce this time to 1 second or less. I am accessing a 50 KB .txt ...

1 2 3 4 5 7
15 30 50 per page