{"id":15035897,"url":"https://github.com/aramzham/byte-array-to-int32-converter","last_synced_at":"2025-04-09T23:20:23.213Z","repository":{"id":113725316,"uuid":"79038778","full_name":"aramzham/Byte-array-to-Int32-converter","owner":"aramzham","description":"Convert byte array to Int32 on C# 6.0","archived":false,"fork":false,"pushed_at":"2017-03-20T16:23:59.000Z","size":7,"stargazers_count":15,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-24T01:11:11.329Z","etag":null,"topics":["converter","csharp-code"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aramzham.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-15T14:48:06.000Z","updated_at":"2018-08-04T12:15:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"1f6dc1f1-1000-45bc-83db-4c420183c1ce","html_url":"https://github.com/aramzham/Byte-array-to-Int32-converter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aramzham%2FByte-array-to-Int32-converter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aramzham%2FByte-array-to-Int32-converter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aramzham%2FByte-array-to-Int32-converter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aramzham%2FByte-array-to-Int32-converter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aramzham","download_url":"https://codeload.github.com/aramzham/Byte-array-to-Int32-converter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248126138,"owners_count":21051875,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["converter","csharp-code"],"created_at":"2024-09-24T20:29:43.583Z","updated_at":"2025-04-09T23:20:23.170Z","avatar_url":"https://github.com/aramzham.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Byte-array-to-Int32-converter\nConvert byte array to Int32 on C# 6.0\n\nThis method takes a byte array and converts it to an Int32.\nHere is the body of the method:\n\n```javascript\npublic static int ConvertByteArrayToInt32(byte[] bytes)\n{\n       var binary = bytes.Reverse().Select(x =\u003e Convert.ToString(x, 2).PadLeft(8, '0')).SelectMany(x =\u003e x).ToArray();\n\n       var result = 0;\n       for (int i = 0; i \u003c binary.Length; i++)\n            if (binary[binary.Length - i - 1] == '1') result += (int)Math.Pow(2, i);\n\n       return result;\n}\n```\n\nAfter measuring the performances of `BitConverter` from `System.Diagnostics`, my custom converter and @tigranv 's `FromByteToInt1`, the outcome reveals that you **don't need to reinvent the wheel**. Everything you need exists already in the language, you just need to find its place. :+1:\n\n\u003cimg width=\"628\" alt=\"untitled\" src=\"https://cloud.githubusercontent.com/assets/25085025/21965082/afdb9c98-db71-11e6-82d2-83a0a7e48645.png\"\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faramzham%2Fbyte-array-to-int32-converter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faramzham%2Fbyte-array-to-int32-converter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faramzham%2Fbyte-array-to-int32-converter/lists"}