Tagged Questions
Java is a popular programming language and runtime environment which allows programs to run unchanged on most platforms.
0
votes
2answers
25 views
Quick Sort Implementation
I have written below code for Quick Sort in Java.
void quicksort (int[] a, int lo, int hi)
{
// lo is the lower index, hi is the upper index
// of the region of array a that is to be sorted
...
0
votes
0answers
21 views
Quick Sort Implementation [closed]
Possible Duplicate:
Quick Sort Implementation
I want to implement Quick Sort in Java. I have written below code.
void quicksort (int[] a, int lo, int hi)
{
// lo is the lower index, ...
2
votes
1answer
44 views
List objects in a Amazon S3 folder without also listing objects in sub folders
I'm using the Amazon S3 Java SDK to fetch a list of files in a (simulated) sub-folder. This code is rather standard (AWSConfiguration is a class that contains a bunch of account specific values):
...
1
vote
1answer
23 views
Quickly put together a reusable configuration reader for Java. Looking for suggestions to improve
This is related to a question I posted on StackOverflow Java: reading Xml configuration and applying to an object, what's a lightweight, simple solution. The consensus was to use JAXB, which is what ...
2
votes
1answer
31 views
Refactoring code duplication so the same textArea is not used in 4 different classes
Looking for the best way to do this.
Currently in 4 different classes I have:
textArea = new JTextArea(10, 55) {
{
setOpaque(false);
}
@Override
protected void ...
2
votes
3answers
70 views
Struggling to refactor code to remove duplication
I really need some help removing some duplicated code. I've linked the methods causing me issues. http://pastebin.com/cZJihM4J
As you can see each method does similar things but retrieve different ...
1
vote
1answer
40 views
How would I change code so that error would not appear anymore? [closed]
/**
* Luokka TekstinLukija sisältää attribuutteina
* lukija:n( Scanner-tyyppiä),
* ja tiedNimi:n( String tyyppiä) ja sillä on myös konstruktori ja metodeja
* @author Alpo Voutilainen, 142632
* ...
2
votes
2answers
88 views
Check if a binary tree is a subtree of another tree
I am doing a refresher on algorithms.
I tried to solve the problem of determining if you have 2 trees (T1 and T2), one is a subtree of the other.
I came up with the following:
public boolean ...
2
votes
1answer
95 views
Could use Advice on 2D Minesweeper text based code
I could use some help with my program. I got my 1 dimensional program to work just fine so I figured I just need I few tweaks to get the 2D to work as well. Its not fully completed but it would help ...
2
votes
1answer
54 views
Sudoku Solver Optimization
I am currently working on a sudoku solver that should be able to solve a 25 x 25 grid. However, I am experiencing problems optimizing it to run quick enough to actually get a result with any grid ...
1
vote
1answer
36 views
Game Of Life rewritten into two classes, PetriDish and Cell
Follow-up to: Game Of Life implemented with for-loops and a boolean-array
As proposed by palacsint I went on and rewrote my implementation of the Game Of Life and extracted everything into two ...
1
vote
2answers
145 views
What is the security issue in this code?
I was asked how this code has a security risk. Does anyone have any ideas what it is? I am new on the security topic and don't know what to look for.
String DBdriver = "com.ora.jdbc.Driver";
String ...
-2
votes
0answers
109 views
Good programming habits - evaluate this very short piece of code [closed]
I am working through an informal assignment (i.e. does not get graded) about the quality of code. I am using Java and this has two parts.
Part one: For the code below, can you explain why this code ...
1
vote
0answers
40 views
Advice on improving my listener pattern implementation
In my project i am doing asynchronous processes in almost every classes.
To explain my problem i have created a sample
public interface TestListener {
void onResponse(Response result);
void ...
2
votes
3answers
90 views
Java n00by Console Calculator
package calc;
import com.sun.tools.corba.se.idl.constExpr.Equal; //imports .equals(variable)
import java.util.Scanner; //imports scanners
public class Calc {
public static void ...