> For the complete documentation index, see [llms.txt](https://docs.1kosmos.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.1kosmos.com/mobile-sdk/native/android/api-reference/classes/bidutil.md).

# BIDUtil

**public class** BIDTenant extends **Object**

↳ **package** com.onekosmos.blockid.sdk.utils

***

Helper class that provides a bunch of related methods to be reused.

### Method Summary

| *type*                                        | **parameter**                                                       | summary                                                            |
| --------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------ |
| **static** **String**                         | **capitalize(String s)**                                            | Converts the first character of given string to upper case         |
| **static List \<JSONObject>**                 | **convertArrayToList(JSONArray jArray)**                            | Converts an array object into a List                               |
| **static** **LinkedHashMap\<String, Object>** | **convertObjectToMap(Object object)**                               | Converts any object into LinkedHashMap                             |
| **static String**                             | **createImageMD(Bitmap bitmap)**                                    | Returns MD5 representation of an image bitmap                      |
| **static \<T> String**                        | **createObjectMD5(T dataObject)**                                   | Returns MD5 representation of any data object                      |
| **static** **String**                         | **getBase64FromBytes**(byte\[] byteArray)                           | Returns bas64 string of given byte\[]                              |
| **static Date**                               | **getCurrentDate()**                                                | Returns the current date                                           |
| **static String**                             | **getDeviceModelName()**                                            | Returns the device model and manufacturer                          |
| **static String**                             | **getDeviceName()**                                                 | Returns the name of device                                         |
| **static Date**                               | **getFormattedDate(String inputDate)**                              | Returns Date object from string representation of given date       |
| **static String**                             | **getSha256Hash(String password)**                                  | Returns SHA256 Hash value of given string data                     |
| **static String**                             | **getSha512Hash(String password)**                                  | Returns SHA512 Hash value of given string data                     |
| **static String**                             | **getSHA512HashWithSalt(String data)**                              | Returns SHA512 Hash value of given string data                     |
| **static long**                               | **getTimestampDifference(long timestamp1, long timestamp2)**        | Returns time difference in hours                                   |
| **static boolean**                            | **isGMSAvailable(Context context)**                                 | Returns is GMS(Google Mobile Services) are available or not.       |
| **static boolean**                            | **isWebViewAvailable(Context context)**                             | Checks whether web view is available or not.                       |
| **static \<T> T**                             | **JSONStringToObject(String json, Class`<T>` classOfT)**            | Converts JSONString representation into an object                  |
| **static String**                             | **md5HashV0(String s)**                                             | Returns MD5 Hash value of given string data                        |
| **static String**                             | **md5HashV1(String s)**                                             | Returns MD5 Hash value of given string data                        |
| **static \<T> String**                        | **objectToJSONString(T classOfT, Boolean disableHtmlEscaping)**     | Returns JSONString representation of an object                     |
| **static boolean**                            | **validateDate(String str)**                                        | Returns if the given string representation of date object is valid |
| **static boolean**                            | **validateMapKeys(LinkedHashMap\<String, Object> map, String key)** | Returns if hash map object contains the given key                  |

### Method Detail

***

#### capitalize

**public static** String capitalize(String s)

* Converts the first character of the given string to uppercase. Returns the same input string if the first letter is already in uppercase.

| Parameter |                           |
| --------- | ------------------------- |
| s         | **String**: Input string. |

***

#### convertArrayToList

**public static** `List<JSONObject>` convertArrayToList(JSONArray jArray)

* Converts an array object into a List.

| Parameter |                                                  |
| --------- | ------------------------------------------------ |
| jArray    | JSONArray: JSON array to be converted into List. |

***

#### convertObjectToMap

**public static** LinkedHashMap\<String, Object> convertObjectToMap(Object object)

* Converts any object into a LinkedHashMap.

| Parameter |                                                       |
| --------- | ----------------------------------------------------- |
| object    | Object: An object to be converted into LinkedHashMap. |

***

#### createImageMD

**public static** String createImageMD(Bitmap bitmap)

* Returns MD5 representation of an image bitmap.

| Parameter |                          |
| --------- | ------------------------ |
| bitmap    | Bitmap: An image bitmap. |

***

#### createObjectMD5

**public static** `<T>` String createObjectMD5(T dataObject)

* Returns the MD5 representation of any data object.

| Parameter  |                                                              |
| ---------- | ------------------------------------------------------------ |
| dataObject | T: Any data object for which MD5 representation is required. |

***

#### getBase64FromBytes

**public static** String getBase64FromBytes(byte\[] byteArray)

* Returns bas64 string of given byte\[]

| Parameter |                                  |
| --------- | -------------------------------- |
| byteArray | byte\[]: Image in byte\[] format |

***

#### getCurrentDate

**public static** Date getCurrentDate()

* Returns the current date.

***

#### getDeviceModelName

**public static** String getDeviceModelName()

* Returns the device model and manufacturer.

***

#### getDeviceName

**public static** String getDeviceName(Context context)

* Returns the name of the device.

| Parameter | Description                |
| --------- | -------------------------- |
| context   | Context: Activity context. |

***

#### getFormattedDate

**public static** Date getFormattedDate(String inputDate)

* Returns a Date object from the string representation of the given date.

| Parameter |                                                  |
| --------- | ------------------------------------------------ |
| inputDate | **String**: String representation of given date. |

***

#### getSha256Hash

**public static** String getSha256Hash(String password)

* Returns the SHA-256 hash value of the given string data.

| Parameter |                                                           |
| --------- | --------------------------------------------------------- |
| password  | **String**: Input data for which SHA256 Hash is required. |

***

#### getSha512Hash

**public static** String getSha512Hash(String data)

* Returns the SHA-512 hash value of the given string data.

| Parameter |                                                           |
| --------- | --------------------------------------------------------- |
| data      | **String**: Input data for which SHA512 Hash is required. |

***

#### getSHA512HashWithSalt

**public static** String getSHA512HashWithSalt(String data)

* Returns the SHA-512 hash value of the given string data

| Parameter |                                                           |
| --------- | --------------------------------------------------------- |
| data      | **String**: Input data for which SHA512 Hash is required. |

***

#### getTimestampDifference

**public static long** getTimestampDifference(long timestamp1, long timestamp2)

* Returns the time difference in hours

| Parameter  |                           |
| ---------- | ------------------------- |
| timestamp1 | **long**: start timestamp |
| timestamp2 | **long**: end timestamp   |

***

#### isGMSAvailable

**public static boolean** isGMSAvailable(Context context)

* Returns whether Google Mobile Services (GMS) is available.

| Parameter |                            |
| --------- | -------------------------- |
| context   | Context: Activity context. |

***

#### isWebViewAvailable

**public static boolean** isWebViewAvailable(Context context)

* Returns whether WebView is available or not.

| Parameter |                            |
| --------- | -------------------------- |
| context   | Context: Activity context. |

***

#### JSONStringToObject

**public static** `<T>` T JSONStringToObject(String json, Class`<T>` classOfT)

* Converts JSONString representation into an object.

| Parameter |                                                         |
| --------- | ------------------------------------------------------- |
| json      | **String**: JSONString to be converted into an object.  |
| classOfT  | **T**: An object to represent the converted JSONString. |

***

#### md5HashV0

**public static** String md5HashV0(String s)

* Returns the MD5 Hash value of the given string data.

| Parameter |                                                         |
| --------- | ------------------------------------------------------- |
| s         | **String**: String data for which MD5 Hash is required. |

***

#### md5HashV1

**public static** String md5HashV1(String s)

* Returns the MD5 Hash value of the given string data.

| Parameter |                                                         |
| --------- | ------------------------------------------------------- |
| s         | **String**: String data for which MD5 Hash is required. |

***

#### objectToJSONString

**public static** `<T>` String objectToJSONString(T classOfT, Boolean disableHtmlEscaping)

* Returns JSONString representation of an object.

| Parameter           |                                                        |
| ------------------- | ------------------------------------------------------ |
| classOfT            | **T**: An object being converted into JSONString.      |
| disableHtmlEscaping | **Boolean**: Flag to indicate if escaping is required. |

***

#### validateDate

**public static boolean** validateDate(String str)

* Returns whether the given string representation of a date object is valid.

| Parameter |                                            |
| --------- | ------------------------------------------ |
| str       | **String**: String representation of date. |

***

#### validateMapKeys

**public static boolean** validateMapKeys(LinkedHashMap\<String, Object> map, String key)

* Returns if hash map object contains the given key.

| Parameter |                                                        |
| --------- | ------------------------------------------------------ |
| map       | **LinkedHashMap\<String, Object>**: A hash map object. |
| key       | **String**: A key to be checked in hash map object.    |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.1kosmos.com/mobile-sdk/native/android/api-reference/classes/bidutil.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
