2 Commits

Author SHA1 Message Date
darkress
3d5749ca71 fixed slicing for images with the condition totalPixels/threadCount != Integer 2023-06-11 03:55:27 +02:00
darkress
78d67a32eb Working slicing (#2)
Co-authored-by: darkress <30271678+DarkressX@users.noreply.github.com>
Reviewed-on: darkress/PixelFloodClient#2
2023-06-11 03:44:34 +02:00

View File

@@ -91,9 +91,11 @@ class Main
public static String[] prepareThreadArray(ArrayList<String> fullArray, int threadNumber, int threadCount) public static String[] prepareThreadArray(ArrayList<String> fullArray, int threadNumber, int threadCount)
{ {
String[] threadArray = new String[fullArray.size()/threadCount];
int count = 0; int count = 0;
for(int i = (threadNumber*fullArray.size())/threadCount; i < ((threadNumber+1)*fullArray.size())/threadCount; i++) int arrayStart = (threadNumber*fullArray.size())/threadCount;
int arrayEnd = ((threadNumber+1)*fullArray.size())/threadCount;
String[] threadArray = new String[arrayEnd-arrayStart];
for(int i = arrayStart; i < arrayEnd; i++)
{ {
threadArray[count] = fullArray.get(i); threadArray[count] = fullArray.get(i);
count++; count++;