code: public static Geometry toGeometry(byte[] bytes, int srid) throws SQLException{
          if(bytes==null) {
              return null;
          }
          WKBReader wkbReader = new WKBReader();
          try {
              Geometry geometry = wkbReader.read(bytes);
              geometry.setSRID(srid);
              return geometry;
          } catch (ParseException ex) {
              throw new SQLException("Cannot parse the input bytes",ex);
          }
      }
docs: Convert a WKB representation to a geometry
  @param bytes the input WKB object
  @param srid the input SRID
  @return
  @throws SQLException