Tagged Questions

Initial help New to Java - need help to get your first Java program running? See the Oracle Java Tutorials section on Getting Started. Background Java is a high-level, platform-independent, object-oriented programming language originally developed by Sun Microsystems and released in 1995. ...

learn more… | top users | synonyms

-1
votes
0answers
33 views

Java breaking down [closed]

I need to break down this code into main meanings and basically just how it works. I do not do any Java programming. So I need alot of help. I do python mainly. This is the code for explorer.class ...
1
vote
0answers
40 views

Android Asynctask… is this the correct way to do it?

I created a small android project with an AsyncTask. It simulates a time consuming task. Please review my code and tell me what you would do on a different way and why. Comments not specific to ...
4
votes
3answers
185 views

Is it better practice to have void method throw an exception or to have the method return a boolean?

This falls straight into the same category with the recent "Is it better practice to return if false or execute an if statement if true?" question. Often, while writing code, I find myself presented ...
1
vote
2answers
63 views

Find two equal substrings in a string

I have various strings that contain codes, e.g. like this: "file = new JarFile(new File()" + "\nSystem.out.println(file" but also "args" Now I want to find the substring that is in the beginning ...
0
votes
1answer
19 views

Efficient implemetation of AlertDialog callback in Android

One day I realised that my Android project utilizes AlertDialogs here and there in very ineffective way. The heavily duplicated portion of code looked like this (actually, copied and pasted from some ...
0
votes
1answer
39 views

How is this for compressing (zipping) files?

I'm writing a Java Helper Library. I want to include a method to zip files together. This is what I've come up with. I'm using the java.util.zip.* library (ZipOutputStream and ZipEntry specifically). ...
0
votes
0answers
33 views

Converting infix expressions to postfix expressions

I thought that this code should solve the problem with inputs with parentheses like 1 * 2 + 3 * ( 5 + 2 ) - 3 and output the postfix expression without parentheses, but the output is 1.0 2.0 * 3.0 ...
4
votes
0answers
69 views

Is it wrong to use a boolean parameter to determine behavior? [migrated]

I have seen a practice from time to time that "feels" wrong, but I can't quite articulate what is wrong about it. Or maybe it's just my prejudice. Here goes: A developer defines a method with a ...
3
votes
1answer
88 views

Java Code for permutations of a list of numbers

I asked this question on stackoverflow but someone directed me to this website. Please help. I have written a program to find all the possible permutations of a given list of items. This precisely ...
2
votes
2answers
73 views

Is Factory Pattern implemented good in this way?

Suppose I have this code: public interface BaseType { public void doSomething(); } public class ExtendedTypeA implements BaseType { //No Instance Variables @Override public ...
1
vote
1answer
28 views

Optimal buffer size for HTTP PUT

I'm uploading videos to Vimeo using the VimeoAPI. I want to show a progress bar to the user. The only way to do this with the VimeoAPI is to call a method to the server which verifies the chunk you've ...
1
vote
0answers
25 views

ReentrantLock with priorities for waiting threads

I am trying to have a ReentrantLock with another way to determinate which thread will have the lock in the waiting queue. ReentrantLock implementation manages a Fair/Unfair policy, that's not what I ...
1
vote
1answer
98 views

Please review my Code Review crawler!

I am writing a program which automatically crawls codes from Code Review site! I'm quite new to java. Would you please review my code? The required .jars: jsoup, org.apache.commons.io. Main.java ...
0
votes
1answer
33 views

Optimal method for writing bytes to file

I'm making a method to save a byte[] to a file. It's for a Java Helper I'm writing, so it needs to be able to handle any kind of system. I saw on this example the method of FileOutputStream called ...
0
votes
1answer
27 views

Optimal buffer size for output stream

I'm writing a method to save an input stream to an output stream. What's the optimal size for the buffer? Here's my method: /** * Saves the given InputStream to a file at the destination. Does not ...

1 2 3 4 5 27
15 30 50 per page