From 2cebef5472e70f2b05d77fce9f276973b1c2a280 Mon Sep 17 00:00:00 2001 From: shellhub Date: Mon, 2 Nov 2020 14:20:49 +0800 Subject: [PATCH 1/2] fixed checkstyle --- .github/workflows/checkstyle.yml | 12 ++++-------- Conversions/BinaryToDecimal.java | 9 +++++---- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/checkstyle.yml b/.github/workflows/checkstyle.yml index 7fce2a20fceb..4a2e972be21c 100644 --- a/.github/workflows/checkstyle.yml +++ b/.github/workflows/checkstyle.yml @@ -1,15 +1,11 @@ name: Code Formatter -on: - pull_request: - push: - branches: - - master +on: [push] jobs: format: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@master - uses: actions/setup-python@v2 - name: Set up JDK 12 uses: actions/setup-java@v1 @@ -24,5 +20,5 @@ jobs: git config --global user.name github-actions git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com' git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY - git commit -am "Formatted with Google Java Formatter" - git push --force origin HEAD:$GITHUB_REF \ No newline at end of file + git commit -am "Formatted with Google Java Formatter" || true + git push --force origin HEAD:$GITHUB_REF || true diff --git a/Conversions/BinaryToDecimal.java b/Conversions/BinaryToDecimal.java index beb71af5107d..562ee3d96114 100644 --- a/Conversions/BinaryToDecimal.java +++ b/Conversions/BinaryToDecimal.java @@ -10,14 +10,15 @@ class BinaryToDecimal { * * @param args Command line arguments */ - public static void main(String args[]) { + public static void main(String args[]) { Scanner sc = new Scanner(System.in); int binNum, binCopy, d, s = 0, power = 0; - System.out.print("Binary number: "); + System.out.print("Binary number: "); binNum = sc.nextInt(); binCopy = binNum; - while (binCopy != 0) { - d = binCopy % 10; + while (binCopy != 0) + { + d = binCopy % 10; s += d * (int) Math.pow(2, power++); binCopy /= 10; } From 7ec02531915a16e35cbf639e47778f9fc31d724c Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Mon, 2 Nov 2020 06:21:39 +0000 Subject: [PATCH 2/2] Formatted with Google Java Formatter --- Conversions/BinaryToDecimal.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Conversions/BinaryToDecimal.java b/Conversions/BinaryToDecimal.java index 562ee3d96114..beb71af5107d 100644 --- a/Conversions/BinaryToDecimal.java +++ b/Conversions/BinaryToDecimal.java @@ -10,15 +10,14 @@ class BinaryToDecimal { * * @param args Command line arguments */ - public static void main(String args[]) { + public static void main(String args[]) { Scanner sc = new Scanner(System.in); int binNum, binCopy, d, s = 0, power = 0; - System.out.print("Binary number: "); + System.out.print("Binary number: "); binNum = sc.nextInt(); binCopy = binNum; - while (binCopy != 0) - { - d = binCopy % 10; + while (binCopy != 0) { + d = binCopy % 10; s += d * (int) Math.pow(2, power++); binCopy /= 10; }