Skip to content
Advertisement

Tag: multidimensional-array

Check if a char is in a 2D array in java

I have been working on my homework of creating a simple chess program. The chessboard is a 2D array, named board. The pieces are all single chars like R,Q,K, and empty space is filled with a ‘ ‘ char, so a space. The method get should return the char or whatever is there on the coordinate (x,y). And the problem

How to split string of mulitdimensional array

i have string here String str1 = “{{1,2,3},{4,5,6},{7,8,9}}” and the result i expect is like this what method i use in java language? Thanks. i tried with split method then put each array into an arraylist variable “data”. result : and try to delete the data array that is empty and which only has a string value”,” result : and

How to check if 2 elements are adjacent to one another in 2D array

I’m trying to figure out how to take in 2 integer parameters, an initial integer referred to as “start” and a second integer referred to as “destination”. I’m wanting to use both parameters from my method, first checking if the starting integer is within the matrix and then checking if the destination integer is adjacent within the 4 elements around

Method Overloading Techinques

I have a method overload that goes as follows: My question is there a way to condense the solution to have one method that takes into account N-Dimensional Arrays. The code runs fine like this however, I would like to know what Java techniques can help account for the increase in dimensions. I would like to add some details and

How to Sort Array and populate it

so I NEED to sort this array by column and populate it bu user input. so this is my code and if you can help me it would be great.. so I NEED to sort this array by column and populate it bu user input. so this is my code and if you can help me it would be great..

Count occurrences in 2D Array

I’m trying to count the occurrences per line from a text file containing a large amount of codes (numbers). Example of text file content: I want to compare a similar set of numbers that I get from a text field, for example: 9107,4405,2387,4499 The only result I’m looking for, is if it contains more than 2 numbers (per line) from

Advertisement