Quantcast
Browsing all 61 articles
Browse latest View live

Double to string Java Loop

Hey so I am trying to get the GC-content of a DNA string is given by the percentage of symbols in the string that are C or G. For example, the GC-content of “AGCTATAG” is .375 or 37.5%. Here is what I...

View Article


What is size of my Bitset?

I want to store System.currentTimeInMillis in memory with minimum space possible. because I have to store millions of them in memory. I converted it to binaryString which gave me 41 bits Here is my...

View Article


In Java what is a dangling meta character and how do I correct this error?

public class StringMerger { public static boolean isMerge(String s, String part1, String part2) { for (int i = 0; i < part1.length(); i++) { s = s.replaceAll(part1.substring(i, i+1) , ""); } for...

View Article

I’m getting an error when trying to get my method to examine the argument

I have to get my method to read if the string has spaces and if it does it goes to the next step which is to see if the string has letters or numbers 1 through 5 in the string. Here is what is stated...

View Article

Sorting XYChart Series Data

Hello I have added data to a XYSeries and am trying to get that data sorted from shortest length to largest. I don’t know how to manipulate this data, Can anyone help me out. This is my code: xLabel =...

View Article


Passing Value Using Intent

click Signup button it must intent signup values to Register class,then if login button pressed it must intent Login value to register class. MainActivity public class MainActivity extends Activity {...

View Article

Can’t seem to figure out how to validate first and last name in java

I’ve been looking on the website to figure out how to do this,and couldn’t find anything. So I’m sorry if this is a repeat. I’ve looked at regex and tried implementing it but I can’t seem to how too. I...

View Article

Creating an ArrayList of Arrays with predetermined length

Essentially, I’m looking to create an ArrayList of Arrays of Notes: /** * Represents the entire musical score, with each index of the ArrayList representing each beat. * Each array of notes represent...

View Article


Call jpegOptim with RedirectStandardInput and RedirectStandardOutput

I’m trying to do something that seems like it should be relatively simple: Call jpegoptim from C#. I can get it to write to disk fine, but getting it to accept a stream and emit a stream has so far...

View Article


Java – Why is str.substring(str.length()) an acceptable line of code?

To make a long story short, why does Java not throw an IndexOutOfBoundsException for this line of code? str.substring(str.length()) Is it just by definition of IndexOutOfBoundsException? To make...

View Article

Determine Whether Index of a String Contains a Character

I’m looking to be able to tell if a String’s index contains any character; for the reason to avoid an StringIndexOutOfBoundsException. Currently what I have setup is this: for (int i = 0; i <...

View Article

Longest Common Substring Java not working properly

I ran a JUnit test on this, these are the cases: case1: assertEquals(“LCS Legnth: 3 LCS: rat ear apple”, LCS.lcs(“rat apple cat ear cat apple rat”, “cat rat ear apple mush”)); case 2: assertEquals(“LCS...

View Article

How to use split a string after a certain length? [duplicate]

This question already has an answer here: Split string to equal length substrings in Java 10 answers I want to split a string after a certain length. Let’s say we have a string of “message” Who Framed...

View Article


How to return 2d array elements location

I am trying to make my createCoords method return the location of every number evenly divisible by 3, and then print them in another equally sized 2d array(with -1s marking the divisble numbers). How...

View Article

Having issues backtracking in my Queen recursion project

I am currently working on a project that deals with recursion, eight queens, and an 8×8 chess board. Most people have heard of this problem, but for those who have not it is where you try to get, in...

View Article


How to sum all y values of all x arrays 2d array into a 1d array?

I’m trying to store all values of a x*y int array into an x length array, but no matter how I do it I end up with various runtime errors. Here is my current code: for(int x=0; x < size.length; x++){...

View Article

How to create a 2d grid array with information from another

I’m trying to print a 2d grid with random numbers and another equally sized grid with -1s in place of the numbers that are evenly divisible by 3. I finished pretty much everything, but the second grid...

View Article


Shift elements of array list in java

so I’m trying to shift an array to the right so that x will appear as 4, 5, 6, 7, 1, 2, 3. I think my algorithm is correct but for some reason it won’t return x and just skips anything after the “x =...

View Article

increase the progressbar percentage

I’ve the below piece of code, where there is a progress bar that has to progressed. public void createFiles(String srcText, String destText, JTextArea outputTextArea, JProgressBar progressBar) { String...

View Article

drawElementsInstanced with OpenGL and Java

I’m trying to render one triangle 100 times on different locations with glDrawElementsInstanced(). I’m not getting it the right way. I tried different tutorials, but their all for c++ and not for java....

View Article
Browsing all 61 articles
Browse latest View live