Update Test_3.java
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
public class Test_3{
|
public class Test_3{
|
||||||
public int search(int [][] matrix, int to_search){
|
public boolean search(int [][] matrix, int to_search){
|
||||||
for(int i = 0; i < matrix.lenght; i++){
|
for(int i = 0; i < matrix.lenght; i++){
|
||||||
for(int j = 0; j < matrix[i].legth; j++) {
|
for(int j = 0; j < matrix[i].legth; j++) {
|
||||||
if (matrix[i][j] == to_search){
|
if (matrix[i][j] == to_search){
|
||||||
@@ -9,9 +9,14 @@ public class Test_3{
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
boolean result = this.contains(new int[][] {
|
public static void main(String[] args){
|
||||||
|
Test_3 ojb = new Test_3();
|
||||||
|
int[][] data = new int[][] {
|
||||||
{1,2,3},
|
{1,2,3},
|
||||||
{22,42,45},
|
{22,42,45},
|
||||||
{38,26,16}}, 42);
|
{38,26,16}}, 42);
|
||||||
}
|
};
|
||||||
|
boolean result = obj.search(data, 420;
|
||||||
|
System.out.println("Found: " + result);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user