Skip to content

Commit

Permalink
cho commit
Browse files Browse the repository at this point in the history
  • Loading branch information
qhdrl12 committed Mar 29, 2018
1 parent 61ff8f5 commit d860112
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Java8Application {
public class JavaApplication {

public static void main(String[] args) {
SpringApplication.run(Java8Application.class, args);
SpringApplication.run(JavaApplication.class, args);
}
}
30 changes: 21 additions & 9 deletions src/main/java/com/tree/Step1/Cjtest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
public class Cjtest {


private static List<String> cho = Arrays.asList("1", "2", "3", "4", "5", "6", "7", "8", "9");
private static Map<Integer, List<String>> map = new HashMap<>();
// private static List<String> cho = Arrays.asList("1", "2", "3", "4", "5", "6", "7", "8", "9");
static String[] strs = {"1", "2", "3", "4", "5", "6", "7", "8", "9"};

private static Map<Integer, String[]> map = new HashMap<>();
private static int mapIndex = 1;

public static void main(String[] args) {
Expand All @@ -32,26 +34,36 @@ public static void main(String[] args) {
char[] cArray = sb.toString().toCharArray();
for (char c : cArray) {
int count = 1;
System.out.println("c : " + c);
System.out.print("char : " + c);
boolean result = true;
while (result) {
// do {
if (map.get(count) == null) {
System.out.print("initMap : " + mapIndex);
mapIndex++;
initMap(mapIndex);
continue;
count = mapIndex;
}

int listIdx = map.get(count).indexOf(String.valueOf(c));
System.out.println(", count : " + count);


int listIdx = Arrays.asList(map.get(count)).indexOf(String.valueOf(c));
if ( listIdx == -1) {
if (String.valueOf(c).equals("6")) {
listIdx = Arrays.asList(map.get(count)).indexOf("9");
} else if (String.valueOf(c).equals("9")) {
listIdx = Arrays.asList(map.get(count)).indexOf("6");
}
}

System.out.println("idx : " + listIdx);
if (listIdx > -1) {
map.get(count).set(listIdx, null);
map.get(count)[listIdx] = "0";
result = false;
} else {
count++;
}
}
// } while (result==true);

}

Expand All @@ -60,6 +72,6 @@ public static void main(String[] args) {
}

private static void initMap(int idx) {
map.put(mapIndex, cho);
map.put(mapIndex, Arrays.copyOf(strs, strs.length));
}
}
13 changes: 13 additions & 0 deletions src/main/java/com/tree/StepOne.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.tree;

import java.util.Scanner;

public class StepOne {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("How old are you");

int age = in.nextInt();
System.out.println("age : " + age);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@RunWith(SpringRunner.class)
@SpringBootTest
public class Java8ApplicationTests {
public class JavaApplicationTests {

@Test
public void contextLoads() {
Expand Down

0 comments on commit d860112

Please sign in to comment.