Java (not to be confused with JavaScript) is a class-based, object-oriented, strongly typed, reflective language and run-time environment (JRE). Java programs are compiled to byte-code and run in a virtual machine (JVM) enabling a "write once, run anywhere" (WORA) methodology.
-1
votes
0answers
7 views
See if an element in int array is in a specific range, Java [on hold]
First off, I'm quite new to android development.
I'm trying to build a game that has achievements, if a player reaches a new highscore, I want to check if he has enough points to unlock a new ...
1
vote
1answer
33 views
Non-Contiguous Substrings
Problem:
A non-contiguous substring of String s is a sequence of k >= 0 characters in s, in the order in which they occur in s. For instance, the set of all ...
-3
votes
0answers
8 views
1
vote
1answer
18 views
Null check when enabling Up navigation in Android
This upvoted SO answer and this upvoted SO answer both check for null in a similar way: they call a function in the if or assert ...
2
votes
1answer
30 views
Sieve of Eratosthenes Primes Efficiency
I'm fairly new to Java and was trying to make a program thats generates the primes from 2 - 100. I originally had a design of my own making but it was fairly inefficient so I did some research and ...
4
votes
1answer
19 views
Test whether target string is substring of source string
The code is self-explanatory. It has \$O(n)\$ complexity, and it tells whether a given string is the substring of the source string. Are there any cases where this algorithm fails? Is there anything ...
4
votes
2answers
39 views
Two string comparison
I wrote a function that finds the difference between two strings. This only works given that the difference is continuous.
Beyond doubt this already exists, I am recreating this for educational ...
2
votes
1answer
29 views
java.sql.Timestamps: There's gotta be an easier way
I have a function that counts how many "assists" a team performs during the course of their day. The way I've written it feels bulky and inefficient using GregorianCalendar.
Basically, the ...
1
vote
1answer
58 views
Determining if two strings are anagrams
Two strings are said to be anagrams of each other if the letters of
one string may be rearranged to make the other string. For example,
the words 'elvis' and 'lives' are anagrams.
In this ...
-3
votes
0answers
13 views
operating system installation on virtual machine [on hold]
what is the differences between the installation process of these operating systems. Fedora 20, Windows 8, Android operating system using VMware player. and I need answers for these questions: 1. were ...
3
votes
2answers
96 views
Getting a list of all fields in an object
I've got the following code that I use to output a list of all (public) fields in an object in an easy(ish) to read way. The issue with it is that the code is not easy to look at, and I'm not sure ...
-4
votes
1answer
29 views
Getting a table on a date [on hold]
You and your date are trying to get a table at a restaurant. "you" is the stylishness of your clothes, in the range 0..10, and "date" is the stylishness of your date's clothes. The result getting the ...
4
votes
5answers
822 views
Two integers x & y
Given two int values, print whichever value is larger. However if the two values have the same remainder when divided by 5, then the print the smaller value. However, in all cases, if the two values ...
2
votes
3answers
57 views
Seasons by month and day
Write a program reads two integers representing a month and day and prints the season for that month and day. Assume that months are specified as an integer between 1 and 12 (1 for January, 2 for ...
4
votes
2answers
31 views
Speeding Up BufferedWriter
Are there any possible speed improvements I can make to the following method. It takes a JDBC ResultSet and breaks it into several CSV files:
...
0
votes
0answers
12 views
Pagination using JSTL
I created a JSP page with pagination using JSTL. The format is like this:
// if page 1 is active
1
// if records <= 10, display nothing more
//otherwise links to all other page numbers with "next"
...
2
votes
1answer
20 views
My own implementation of an hashtable
This is my own implementation of an hashtable. I would like to receive some reviews or some feedbacks.
...
-5
votes
0answers
22 views
6
votes
2answers
68 views
Sudoku game with varied difficulty level
I created a Sudoku game with varied difficulty level.
The Sudoku board creation process consist three stages:
Creation of an empty board
Filling the board with numbers
Making holes in the filled ...
2
votes
1answer
154 views
Check and clear last value
I have a method like this:
public boolean wasUserInactive() {
boolean result = userInactive;
userInactive = false;
return result;
}
This works, ...
0
votes
0answers
23 views
trying to make a Sudoku Solver with the recursive backtracking method [on hold]
I am a complete beginner, and Im just trying to learn general coding skills. I picked a sudoku solver as an intro project to get a grasp of java programming, but I cannot quite get it to work. Could ...
2
votes
1answer
42 views
Simple Java Tic-Tac-Toe game
About 2 weeks ago i made a java game of Tic-Tac-Toe. It turned out great and it worked but it needed lots of help before it came a decent program. Since then i have worked out lots of the kinks and ...
-3
votes
0answers
13 views
Bouncing ball program is not working [on hold]
In this bouncing ball program,when i call t.start() run method starts working as it prints value of x and y. but there is no change in position of ball. I have also called repaint() from run method. ...
5
votes
1answer
45 views
Live Graphical Demonstation of a Breadth-First Search Algorithm
As a first step to making a PacMan clone, I wrote a Breadth-First Search demonstration that updates itself live as you draw walls and drag around the start and end points. It was inspired by the site ...
5
votes
1answer
54 views
This LoginPane is a Pain
Well, it really isn't a big pain: but I fear of security risks (if that is even possible).
Background:
I decided to (sort of) abandon my Sudoku project (because I accidentally deleted it from disk), ...
4
votes
1answer
81 views
Read Twitter users from a text file
I have this code for reading Twitter users from a text file represented by integers in the format "int (space) int", where the first int is the ID of
the user doing ...
4
votes
1answer
57 views
Airline Reservations
I am looking for general feedback on this small, simple program I wrote. It works perfectly, but I am striving for readable, clean code. I also have specific questions:
(1) Is the 'switch' ...
0
votes
0answers
14 views
Count numbers that are in an interval [on hold]
I'm new to Java and have to write code that asks the user for two numbers as an interval. Then the user must introduce n numbers and the program must return how many numbers belong to that interval.
...
3
votes
2answers
46 views
Find existing player to update or create new one
I'm making a game in Java 7, and I have this block of logic when handling an update from the server.
...
1
vote
2answers
82 views
A Stock Control System, programmed in Java, using JavaFX for GUI
I have programmed this simple Stock Control System using JavaFX for GUI and PostgreSQL for database.
I'd highly appreciate it if you can go through my code and review it and point out flaws, ...
4
votes
1answer
158 views
Print and calculate French written numbers from 1 to 1000 using imperative Java
I've written a little (imperative) java program that basically prints out all french written numbers from 1 to 1000. (I'm learning how to write them)
Based on the first numbers (1-16) and the tens ...
4
votes
1answer
61 views
Knights Tour — Something I am doing wrong
I have an assignment to write a knights tour backtracking program in Java where the professor says to:
Eliminate backtracking time by:
...
3
votes
1answer
83 views
Little/Big Endian conversion
I wanted to make sure that my code is properly converting between the two endians.
Here is the code where I read in an integer:
...
12
votes
1answer
143 views
Printing large numbers, or not large but LARGE
I just started learning Java about a month ago. I'm wondering, what would an experienced developer do differently in the code below? As I learn to code, what direction should I be pushing myself?
I ...
-2
votes
0answers
22 views
sorting three integers in descending order [on hold]
I already have the ascending order for three integers but for whatever reason i cannot make it descend
This is what i have for ascending
...
8
votes
0answers
66 views
A Full-Color Clone of Conway's Game of Life, with a Decent GUI
A wrote this to learn JavaFX, and as an excuse to re-make the Game of Life. This is the most complex GUI I've ever written, so I'd like feedback mainly on it, but I'll welcome any criticism!
My ...
5
votes
2answers
113 views
Find the next prime number — flow control of nested `for` loops
This code works perfectly, but it bothers me. Having a labeled, nested for loop, with a true condition, a ...
3
votes
1answer
34 views
Coordinating Threads with Reactive Streams
I just started learning reactive streams with RxJava. After reading a couple of books and a lot of articles our there I am still having trouble understanding how to coordinate multiple threads.
I ...
8
votes
4answers
384 views
Simple GCD utility in Java
I previously discussed the performance concerns about different GCD algorithms. I wrote a simple Java class that implements the Binary GCD algorithm. It is a really tiny class that has only two ...
3
votes
2answers
23 views
LinkedList Queue implementation
I'm working on a project which simulates (very simple/watered down) a network. The basis of this is to learn how to implement a Queue. I understand there are many ...
-1
votes
0answers
5 views
-3
votes
0answers
24 views
Length and sum of longest increasing subsequence [closed]
I wanted to count sum and length of the longest subsequence in the given array t.
...
-2
votes
0answers
25 views
4
votes
2answers
80 views
Sort array of Numbers with some values always first
The first number will be dynamically selected and remaining array should be sorted ascending
...
0
votes
0answers
26 views
How to push a pair of 3 integers into Priority Queue in Java? [closed]
I'm trying to push/add a pair of 3 integers into a PriorityQueue, but getting an error. Here's my code:
...
2
votes
4answers
196 views
Making a better Engineer
I have an Engineer which doesn't look very good. How can I make him better organized? What about good practices?
Interface:
...
4
votes
2answers
61 views
App to list books from JSON data
I recently submitted the code for this for an 2 hour interview but I was rejected.
The app shows book information with a image, title, and author. Each entry has a title but some entries have no ...
1
vote
1answer
31 views
Find permutation of a specified lexicographic rank
This is one result of my work on Project Euler to learn Java. I'm interested in how well this conforms to best practices as well as any recommendations on efficiency. (I'm pretty sure this code is a ...
2
votes
2answers
57 views
Waterloo Programming Contest: The Game of 31
Please review my program for the Game of 31.
The game of 31 was a favourite of con artists who rode the railroads in days of yore. The game
is played with a deck of 24 cards: four labelled each ...
2
votes
1answer
28 views
Arduino serial data input output
I have created an Arduino sketch that I am using to send and receive data via serial. It works pretty well and doesn't seem go wrong as long as the correct formats are received. Is there anything I ...