From 91c19921ef99ada3cf676afa861bef9483eec0d6 Mon Sep 17 00:00:00 2001 From: nbdgit Date: Sun, 14 Apr 2019 16:55:05 +0530 Subject: [PATCH] Commit BinaryToGray --- .../java/com/conversions/BinaryToGray.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/main/java/com/conversions/BinaryToGray.java diff --git a/src/main/java/com/conversions/BinaryToGray.java b/src/main/java/com/conversions/BinaryToGray.java new file mode 100644 index 00000000..7b14c2a1 --- /dev/null +++ b/src/main/java/com/conversions/BinaryToGray.java @@ -0,0 +1,30 @@ +package src.main.java.com.conversions; + +public class BinaryToGray +{ + /* This method convert the binary number into gray code + @param binaryno need to convert binary number into gray code + @return graycode return as string + */ + + public String binaryToGray(String binarycode) + { + + String graycode=Character.toString(binarycode.charAt(0)); + + + for(int i=0;i